zlacker

[parent] [thread] 6 comments
1. klodol+(OP)[view] [source] 2024-01-16 15:25:38
-Ofast is one of those dangerous flags that you should probably be careful with. It is “contagious” and it can mess up code elsewhere in the program, because it changes processor flags.

I would try a more specific flag like -ffinite-math-only.

replies(3): >>Sharli+Q4 >>Wander+7p >>gpdere+fR
2. Sharli+Q4[view] [source] 2024-01-16 15:43:57
>>klodol+(OP)
finite-math-only is a footgun as well as it allows the compiler assume that NaNs do not exist. Which means all `isnan()` calls are just reduced to `false` so it’s difficult to program defensively. And if a NaN in fact occurs it’s naturally a one-way ticket to UB land.
replies(2): >>klodol+ua >>Maulin+Lf1
◧◩
3. klodol+ua[view] [source] [discussion] 2024-01-16 16:07:28
>>Sharli+Q4
If that’s a foot gun, then -Ofast is an autocannon.

I like to think that the flag should be renamed “-Ofuck-my-shit-up”.

4. Wander+7p[view] [source] 2024-01-16 17:16:50
>>klodol+(OP)
Is that changing of global processor flags a x86 feature or does it hold for arm as well?
replies(1): >>accoun+1L2
5. gpdere+fR[view] [source] 2024-01-16 19:14:41
>>klodol+(OP)
IIRC the changing global flags "feature" was removed recently from GCC and now you have to separately ask for it.
◧◩
6. Maulin+Lf1[view] [source] [discussion] 2024-01-16 21:03:16
>>Sharli+Q4
As 1 of ∞ examples of UB land, I once had to debug JS objects being misinterpreted as numbers when https://duktape.org/ was miscompiled with a fast-math equivalent (references to objects were encoded as NaNs.)
◧◩
7. accoun+1L2[view] [source] [discussion] 2024-01-17 08:24:37
>>Wander+7p
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/...

So, yes when targeting VFP math. NEON already always works in this mode though.

[go to top]