<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64605>64605</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Regression 16 -> 17] Template instantiation ignores FENV_ACCESS being ON for both definition and instantiation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
regression,
miscompilation,
floating-point
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hubert-reinterpretcast
</td>
</tr>
</table>
<pre>
Consider:
```cpp
#pragma STDC FENV_ACCESS ON
template <typename>
int b() {
int x;
if ((float)0xFFFFFFFF != (float)0x100000000) {
x = 1;
}
return x;
}
int f() { return b<void>(); }
```
Clang 16 generates the floating-point operations (as is appropriate for `FENV_ACCESS` being `ON`):
```
f(): # @f()
mov eax, 4294967295
cvtsi2ss xmm0, rax
movabs rax, 4294967296
cvtsi2ss xmm1, rax
ucomiss xmm0, xmm1
mov eax, 1
ret
```
Clang "17" currently generates no floating-point operations:
```
f(): # @f()
ret
```
Compiler Explorer: https://godbolt.org/z/PcoaaxzKn
Reverting fde5924dcc69fe814085482df259b8cfee236f2c restores the previous behaviour.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVF1vrDgM_TXmJeooOMDAAw_tfLys1K5ur_Z1FcAwWUGCkjCa3l-_Suaj096722uNBmKb4-NjsHRODZqohvwJ8m0iF38wtj4sDVn_YElpT3a25FvpfNKY7q3eGO1URxbEI_At8Eco-PnXzvPFg2K2cpgke_2-3bD97vmvvx83m93rK3t5Pqd4muZRemIgNv5tJi0nArE7B5X2rAEsASsG66ezk7HgPoF4P_csJpX9aKQHrPhpfzEGmILYsg_BlF_sEy5jJxaS0ztsWG-vt5b8YvVd5VssEOrfeV4zGxCbo1Fd6CcGQTy9A97kuhzj_2aUemBpwQbSZKUnx_yBWOSu9PAwm1DLzCGmjHahMemYckzOszWzVUHL3lgGBb_TGwrOGlJ6CP6X51A10Pk8ufOxv7KNmvy_AQoGGb8-clMy2GSOjOQJcMMyrLKqWGOVf0xpj94pdO56Pk0TD_lWnn7Cko2L_nu44ku49JdwS2sm5dytXkz8iXywSwOfopb8l1MExHQNiKxdrCXtx7e7qWrz30P9jbn8UvYvSJlpViNZtjvNo7Hxw2UH7-dYD_eA-8F0jRn9ytgBcP8DcP9na6Q8_fhD3yN9oyPZwJz1HeUVZl3bFlVPZZrxMs9K7HrMq6ZseyIURY8ts-S8sZe3ebZ0VGZxrKGDDHd2lXS16CpRyYTqtKjSNS_KiieHuunXXdWksusopTzP8yJrBGLO26IUMpeJqpGj4GXKEUWW81UvU6rKKqtK2a2x6CDjNEk1rsbxOIXWEuXcQnWRFTxPRtnQ6OLaQ2zD3EA89tZoT7oDRMANIFoaLDmnjL65JuXaqGic2c39cajBnW8TW4faD80yOMj4qJx372y88mPcu99uRcICeACxY-ka8i37ft2RSjsvtVexJFODjpLer9XzN_7yHFdAY_yBddQrreIDUncfIZLFjvWnV0D5w9KsWjMB7gPHy-VhtuYfaj3gPsrnAPdRwX8DAAD__0nSxNQ">