http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47834

           Summary: Compiler uses unsafe math optimizations even
                    -funsafe-math-optimizations is not given
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: stene...@gmail.com


Created attachment 23425
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23425
Complete program needed for the bug triggering

Dear Sirs,


I have different result of executing program if I compile it with -On (n=1,2,3)
optimization flag relative to compilation without optimizations. It seems that
-On flag forces -funsafe-math-optimizations and/or -fassociative-math and/or
-freciprocal-math without possibility to disable it. It effects in g++
including MinGW.

I send you program based on the floating point arithmetic rounding properties
in the attachment. The only correct result of the executing this code based on
the Shewchuk's summation algorithm is 0. This is realy result of the program
compiled by the command line

g++ shewchuk.cpp

but if I compile it by any of the command lines

g++ -O3 shewchuk.cpp
g++ -O3 -fno-unsafe-math-optimizations -fno-associative-math
-fno-reciprocal-math shewchuk.cpp

I obtain the result different than zero.


Best regards

Reply via email to