[Bug c/56608] New: built-in floor function returns false results when build with -ffast-math

udifuchs at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 13 02:55:00 GMT 2013


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

             Bug #: 56608
           Summary: built-in floor function returns false results when
                    build with -ffast-math
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: udifuchs@gmail.com


In some cases floor() seems to return 0 value even if its argument is larger
than 1. This happens when compiling with '-O3 -ffast-math'.

Attached is the smallest code I found, which reproduces the problem. The
comments in the code explain how to reproduces the problem. There is also an
example of how a small tweak hides the problem.

Udi



More information about the Gcc-bugs mailing list