From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7576 invoked by alias); 13 Mar 2013 02:55:43 -0000 Received: (qmail 7522 invoked by uid 48); 13 Mar 2013 02:55:20 -0000 From: "udifuchs at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56608] New: built-in floor function returns false results when build with -ffast-math Date: Wed, 13 Mar 2013 02:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: udifuchs at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-03/txt/msg00997.txt.bz2 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