-Ofast/-ffast-math and SPEC 511.pov miscompilation with gcc 13.0

Vineet Gupta vineetg@rivosinc.com
Thu Feb 2 23:38:05 GMT 2023


Hi,

I've noticed SPEC 2017, 511.pov failing for RV64 on bleeding edge gcc.
This is with -Ofast -march=rv64gcv_zba_zbb_zbc_zbs.
Problem also happens with -O3 -ffast-math (and goes away with fast-math 
removed)

I've bisected it to b7fd7fb50111 ("frange: drop endpoints to min/max 
representable numbers for -ffinite-math-only")
With that commit evrp is eliding a bunch of if conditions as they 
pertain to inf (in code snippet below, it elides code corresponding to 
lines 1401-1418 with line 1417 being elided causing the failure).

I think I know the answer, but  just wanted to confirm if that is the 
intended behavior given -Ofast / -ffast-math

Thx,
-Vineet


|New->Angle = __builtin_huge_val(); ||||switch(New->Type) ||{ ||... 
||1246: if(Parse_Camera_Mods(New) == false) ||EXIT ||... ||} ||||1401: 
if (New->Up[X] == ||||__builtin_huge_val|()|) { ... } 1417: if 
(New->Angle != |||__builtin_huge_val|()) ||{ ||1419: if ((New->Type == 
PERSPECTIVE_CAMERA) |||


More information about the Gcc mailing list