https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80450

            Bug ID: 80450
           Summary: -std=c99 breaks -frounding-math on i686
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

on i686 the following code is miscompiled with -std=c99:

void f() { volatile double x = 0x1p-1000*0x1p-1000; }

with -S -O2 -frounding-math:
f:
        subl    $20, %esp
        fldl    .LC0    ////// 0x1p-1000
        fmul    %st(0), %st
        fstpl   8(%esp)
        addl    $20, %esp
        ret

with -S -O2 -frounding-math -std=c99 a.c:
f:
        subl    $20, %esp
        fldz            ////// unconditional 0.0
        fstpl   8(%esp)
        addl    $20, %esp
        ret

note that there is double rounding (first to 80bit floats then to 64bit),
but with upward rounding the result is non-zero either way so the -std=c99
code is wrong (in c99 only static initializers are evaluated in default fenv).

Reply via email to