From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32681 invoked by alias); 2 Jun 2007 00:11:04 -0000 Received: (qmail 32652 invoked by uid 48); 2 Jun 2007 00:10:56 -0000 Date: Sat, 02 Jun 2007 00:11:00 -0000 Message-ID: <20070602001056.32651.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/32183] -fast-math causes a missed optimization to happen In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl at lucon dot org" 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: 2007-06/txt/msg00069.txt.bz2 ------- Comment #5 from hjl at lucon dot org 2007-06-02 00:10 ------- (In reply to comment #3) > (In reply to comment #2) > > Is that OK to transform > > > > float sf; > > ... > > sf = 500 * sf; > > for (i = 0; i < ceplen; i++) > > sum[i] *= sf; > > > > to > > > > for (i = 0; i < ceplen; i++) > > sum[i] = (sum[i]* 500)*sf; > > > > You can certainly get the different results when sf is small and sum[i] is > > large. > > with -ffast-math, this transformation is ok (although it does not seem to make > sense to do it, it moves a multiplication into a loop). > We moved a multiply, which is outside of loop in source, into a loop. I don't think gcc should do it with any optimization flag, including -ffast-math. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32183