<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143360>143360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[RISCV] -ffast-math issue on llvm 20.1.0
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
amitch1999
</td>
</tr>
</table>
<pre>
Hi,
Compiling this simple test, which is taken from gcc's regression, works on llvm 18.1.7, but gets a link error on llvm 20.1.0 (undefined reference to 'link_error')
Compiled using `clang test.c -O2 -ffast-math -lm`
On llvm 20 & 18, without the `-ffast-math` flag, compilation passes.
(my default march is `rv32imc`, but I tried if with a couple different march's(32/64, with/out `f`, with/out `d`) with the same result)
```
extern void link_error(void);
extern double atan(double);
int main()
{
if (atan(1.0) < 0.78 || atan(1.0) > 0.79)
link_error(); /* expected to be optimized out */
return 0;
}
```
Is this expected?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcU01v4zYQ_TWjy8ACNbL1cdDB61RoTgu0QK8FRY0kNpRokFR2t7--IK2kSQADhmbevHnzwCe91_PG3MHlG1yeMrmHxbpOrjqopWjbNhvs-Kv7XQPdEMT1Zte7NnqbMSzao9fr3TAG9iECfixaLag9BvnCG07OrjgrBVR7dDw79l7bLSGte_FoNzTmdcWiyYu8jvVhDzhz8CjR6O0F2Tnr3nEk8iIXCNTs28iT3nhExxM73hRjsAhUx7G_0xhQDdSCuL7r5hF3H8VDJZSR8Qr2IVd4-k54mibpw2mVYcGTWaESIK7f3zcjUIVFk8TrsNg9YFg4Mn0YhErgZOQcUSqtlEHbDe_Se_Z51ELN-gtHnuRuAq7SPQyDSrjXkvSq4t7DiGcMTvOIekorUaKye_R71FM6-iCI_gI1JQH11flNIVAfRUIlpoPzc3VM1fZBHU_xcmV07HcTDt8qcfzElX8Gdhu-Wj3iR4ubWInw8tvD6QM42n0wjDLIDah5fH2E6SRex-axrI4djMcCNcdckSeJUN5Q5HWDUN-gvuHX7m-x2z54Pqt7rESgHuiK_PPOKvAYn8rAaO9Br_pfHjFZQtcIS-oQHYfdbSgOwfXTFz9AXJ_9IwRvrFD22diVY1u2MuOuqM_tuSrKtsyWrhFcjKqaVNGch6GteCDZiKaUoh1FrUSmOxJ0EZVoRUvtpcyFonaggc-KSJTcwFnwKrXJ43vMrZsz7f3OXXEuy0pkRg5sfIox0cY_MHWBKKbadXHoNOyzh7Mw2gf_P03QwaT8__H85-0vuDx9SkKi-RLAbHemW0K4eyiTZ9TPOiz7kCu7AvURevyd7s7-wyoA9YnJA_WH4teO_gsAAP__kZde0Q">