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

            Bug ID: 93682
           Summary: Wrong optimization: on x87 -fexcess-precision=standard
                    is incompatible with -mpc64
           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: ---

Spotted by Alexander Monakov in bug 85957, comment 10...

Not sure if -mpc64 is supposed to be compatible with
-fexcess-precision=standard (and -std=c11 which enables it) but I don't see any
warnings in the description of these options.

-mpc64 changes hardware precision but the optimizer seems to be unaffected
which leads to discrepancies. For example, AIUI -fexcess-precision=standard is
supposed to give predictable results but the results of the following testcase
depend on the optimization level:

----------------------------------------------------------------------
#include <stdio.h>

int main()
{
    int x = 1;

    printf("%a\n", 0x1p-60 + x - 1);
}
----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -m32 -march=i686 -mpc64 test.c &&
./a.out
0x0p+0
$ gcc -std=c11 -pedantic -Wall -Wextra -m32 -march=i686 -mpc64 -O3 test.c &&
./a.out
0x1p-60
----------------------------------------------------------------------
gcc x86-64 version: gcc (GCC) 10.0.1 20200211 (experimental)
----------------------------------------------------------------------

Reply via email to