<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116568>116568</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Miscompile: overwrapping local variable storages
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fujii
</td>
</tr>
</table>
<pre>
I'm using clang-cl 19.1.3 to compile Windows WebKit.
In `JSRopeString::resolveToBufferSlow`, the storages of a local variable `workQueue` and an argument variable `buffer` overwraps.
https://github.com/fujii/WebKit/blob/121f8dbaea55dc714e67c6da747cd5c983bfdea3/Source/JavaScriptCore/runtime/JSStringInlines.h#L219-L232
I added debug logging to show the addresses and the sizes of them.
~~~
workQueue 00000049FE9FE148-00000049FE9FE258 272
buffer 00000049FE9FE238-00000049FE9FE248 16
~~~
I uploaded the preprocessed RegExpPrototype.cpp.
https://drive.google.com/file/d/1zBqMDgtRCCyB_BUWAjj495EzF9uMVqNc/view?usp=sharing
> clang-cl.exe /nologo -TP /Zc:dllexportInlines- /W4 -fcolor-diagnostics -Werror=undefined-internal -Werror=undefined-inline -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-parentheses-equality -Qunused-arguments -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align /DWIN32 /D_WINDOWS -fno-strict-aliasing /O2 /Ob2 -clang:-std=c++23 -MD /clang:-masm=att /Zi /GS /EHa- /EHc- /EHs- /fp:except- /GR- /analyze- /bigobj /utf-8 /validate-charset /WX -c RegExpPrototype.i
~~~
clang version 19.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
~~~
I'll try create a simple repro.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VU934yYQ_zT4wsNPAv-RDz44dtRmm-yfeLvu62XfCEYyKQItIDvJYT97H5Kz3Wy31QFGzD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