<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/109012>109012</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            SPEC CPU 2017 511.povray_r fails at runtime when built with clang-cl on Windows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pulidocr
      </td>
    </tr>
</table>

<pre>
    Hi,

I'm trying to run SPEC CPU 2017 C/C++ benchmarks on Windows with clang-cl, but for some reason it is failing at runtime for 511.povray_r. It fails with `-clang:-O3 -clang:-ffast-math` which suggests it might be a miscompilation. Any help reducing the problem further would be appreciated - for now, I have provided a small config file.

Additional details:

- It used to work with LLVM 17 but fails with LLVM 18.
- Happens on both x64 and ARM64 Windows.

Minimal config file:

```
CC_VERSION_OPTION   = ""
CXX_VERSION_OPTION  =  ""
CC                 = clang-cl.exe /TC
CLD                = clang-cl.exe
CXX                = clang-cl.exe /TP
CXXLD              = clang-cl.exe
OBJ                = .obj
PORTABILITY = /DSPEC_P64
OPTIMIZE    = -clang:-O3 -clang:-ffast-math
CXXOPTIMIZE = /EHsc
```

Repro steps:

1. Obtain SPEC CPU 2017 and set it up for Windows
2. Download Visual Studio 2022 and install the "Desktop development with C++" workload.
3. Install clang/LLVM through LLVM's installer.
4. Copy and paste the above config file contents to `spec2017\config\test.cfg`
5. Open x64 Native Tools Command Prompt for VS2022
6. If clang-cl.exe is not already on PATH, `set "PATH=path\to\LLVM\bin;%PATH%`
7. `cd path\to\spec2017`
8. `shrc.bat`
9. `runcpu -a validate --rebuild --size test  --iterations 1 -c test 511.povray_r`
10. Observe that the benchmark builds successfully, but fails at runtime with LLVM 18. Works with LLVM 17.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVd9v4jgQ_mvMyyhRYkiABx5oKCqndkEt1927l8pJ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