https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93681
Bug ID: 93681 Summary: Wrong optimization: instability of x87 floating-point results leads to nonsense Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ch3root at openwall dot com Target Milestone: --- x87 floating-point results are effectively unstable due to possible excess precision. Without -fexcess-precision=standard, this instability can taint everything around and lead to nonsense. Instability is not limited to FP numbers, it extends to integers too: ---------------------------------------------------------------------- #include <stdio.h> __attribute__((noipa,optnone)) // imagine it in a separate TU static int opaque(int i) { return i; } int main() { int z = opaque(1) + 0x1p-60 == 1; printf("z = %d\n", z); if (z) puts("z is one"); } ---------------------------------------------------------------------- $ gcc -std=gnu11 -pedantic -Wall -Wextra -Wno-attributes -m32 -march=i686 -O3 test.c && ./a.out z = 0 z is one ---------------------------------------------------------------------- gcc x86-64 version: gcc (GCC) 10.0.1 20200211 (experimental) ----------------------------------------------------------------------