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

            Bug ID: 110564
           Summary: Incorrect results from floating point computations on
                    x86 when optimized
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drh at sqlite dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 55484
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55484&action=edit
bug.c - compile and run to demonstrate the problem

Simplified test case attached.  Incorrect floating point result on Linux x86
when compiling and running as follows:

    gcc bug.c -m32 -O1 && ./a.out

The problem goes away under any one or more of the following conditions:

  *  Omit the -m32 flag (to generate x86_64 code)
  *  Omit the -O flag or use -O0
  *  Add the -ffloat-store option
  *  Uncomment both of the "printf()" statements in the test case

Please advise if I am doing something wrong (undefined or unspecified behavior)
so that I might fix it.

SQLite bug report at https://sqlite.org/forum/forumpost/ee7278611394034c.  A
work-around has been checked into SQLite at
https://sqlite.org/src/info/5d9e9364808793d6.  Please advise if there is a
better work-around.

Reply via email to