[Bug optimization/13608] New: [3.3 regression] Incorrect code with -O3 -ffast-math
roger at eyesopen dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 7 21:15:00 GMT 2004
The attached C++ code produces incorrect (different) results when compiled with
"-O3 -ffast-math" (and "-O2 -finline-functions -ffast-math") than it does when
compiled with just "-O3" or with "-O2 -ffast-math". The problem appears in
both gcc 3.3.2 and the current gcc-3_3-branch (3.3.3 prerelease), but works
correctly on mainline, gcc 3.3, and gcc 3.2.x.
Even minor changes to this reduced testcase seem to allow the problem to
disappear. Removing the "throw ()" attribute from sin and cos fixes the
problem. Using, "extern "C" double sin(double);" and "extern "C" double
cos(double);", i.e. GCC's builtins, fixes the problem. Even changing the
alloca's to mallocs fixes the problem!!
I'm filing the PR so that the regression hunters can identify both the
patch that introduced this regression between 3.3 and 3.3.2, and also
the patch that fixed it between 3.3 and current mainline.
[Attachment to follow!]
--
Summary: [3.3 regression] Incorrect code with -O3 -ffast-math
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: roger at eyesopen dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13608
More information about the Gcc-bugs
mailing list