From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18035 invoked by alias); 7 Jan 2004 21:15:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18014 invoked by uid 48); 7 Jan 2004 21:15:46 -0000 Date: Wed, 07 Jan 2004 21:15:00 -0000 From: "roger at eyesopen dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040107211538.13608.roger@eyesopen.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/13608] New: [3.3 regression] Incorrect code with -O3 -ffast-math X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg00676.txt.bz2 List-Id: 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