From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24079 invoked by alias); 31 Aug 2010 14:04:00 -0000 Received: (qmail 21944 invoked by uid 48); 31 Aug 2010 14:03:45 -0000 Date: Tue, 31 Aug 2010 14:04:00 -0000 Message-ID: <20100831140345.21942.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/44606] Wrong SPE floating point during computation In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "Kyle dot D dot Moffett at boeing dot com" 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: 2010-08/txt/msg02543.txt.bz2 ------- Comment #5 from Kyle dot D dot Moffett at boeing dot com 2010-08-31 14:03 ------- Created an attachment (id=21605) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21605&action=view) Further stripped testcase with problematic section identified Ok, I've spent a bit more time fiddling with this testcase, and I believe I can display exactly where the bug happens. In the attached "test.c" file, you can see a section like this: saved_r = total_r; saved_g = total_g; saved_b = total_b; Minify(2*x + 10, 15.0); save2_r = total_r; save2_g = total_g; save2_b = total_b; The "Minify()" macro is supposed to add nonzero values to total_[rgb] but when compiled with -O2 (or -O1 and a few extra optimizations) the values of save2_[rgb] are the same as those of saved_[rgb]. I'm also attaching a Makefile I used while testing this program. In the Makefile I enable -O1 and then turn off every optimization pass that is not strictly necessary to reproduce the bug. The Makefile simply builds 2 copies of the program, one with -O0 and one with -O2, then runs them and compares their output. Some kind of loop optimization or unrolling seems to be involved. The specific optimizations which are mandatory for the bug to show up are below, if any of these is turned off the bug seems to go away: -fdce -fguess-branch-probability -fschedule-insns -ftree-ch -ftree-dominator-opts -ftree-loop-optimize Cheers, Kyle Moffett -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44606