<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62762>62762</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
32-bit-only misoptimization of `printf` calls on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
regression,
platform:win32
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CaseyCarter
</td>
</tr>
</table>
<pre>
This program:
```c
#include <stdio.h>
#include <stdlib.h>
int main() {
for (int i = 0; i < 32; ++i) {
printf("%u ", rand());
}
printf("\n");
}
```
prints 32 copies of the same integer value when compiled with optimization in an x86 Visual Studio 2022 17.7 Preview 1 command prompt (`clang -O1 repro.c -o repro.exe`). Note that this is the first VS preview to include Clang 16, specifically LLVM-16.0.1. Clang 15.0.1 included in the box with VS 2022 17.6 correctly compiles the program with and without optimization targeting either x64 or x86.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U02PszgM_jXhYhVB-CoHDm_b7endD2lWs-cABrwKCUrMdLq_fhXodGa02go1duLHjp_HUd7TaBAbUZxEcYnUypN1zVl5vJ-VY3RRa_t78-dEHhZnR6dmkf0QyUUkP0SZ7F_38GVGptNrjyCys-eebDyJ7Jf_OdXUfj3e_skwzIqMkEchaxDVad8HABisAyGPIYRAZBdIRHbazDNkMthCnoQ80X-Q4bc4MjxseaWQxQrbeganTL9XC1_2BSWqy6fzDV6czYb-jH_GPjnZ3Q3mIZPQ2YXQgx2AJwSvZgQyjCM6eFN6RbhNaKCz80Iae7gRT2AXppn-UUzWABlQBt6PJbySX5WGF157siATKSGt4gr-cPhGeIM0pJmV6YNi88KBtaCSVmaEw-8pOFycjTs42IeJ7xiuLOsYfrOMwJNi4KA5-e2-AznP8PoCy6MGW_hQ87zlTcvApl-wo4E6pfUdfv58_fWQlnESp_FHVBG8D2gfmgrpW_u-d_z68uynhM46hx3r-wct-10eY7gDQpfBsCt_p4uVG5HJjIDEEzp4L3OwLhAY79pEfZP1dVarCJu0POZZUudlEk3NMORD22Lb4bHGoiiGMq-qth2w69tjNdQRNTKRWVKkVVLleVrHmONQJmrAts7qo-xFnuCsSMdav82xdWNE3q_YlLIqZaRVi9pvT07KTZV9FoWUDkeH3pM1z61FKx6sC8_uRiaT2wBeIteE3Id2Hb3IE02e_Wc1JtbYZPLQEh-s0XeYyX-jxw4gyuQx1WUCQTEP1sBfZHp789HqdDMxLz48d3kV8joST2sbd3YW8hpKPZbD4uzf2LGQ161LL-R1a_TfAAAA__-soFY9">