From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23423 invoked by alias); 12 Feb 2011 06:36:21 -0000 Received: (qmail 23320 invoked by uid 22791); 12 Feb 2011 06:36:20 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 12 Feb 2011 06:36:14 +0000 From: "pinskia at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/47708] incorrect code on -O2 without -fno-tree-pre X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sat, 12 Feb 2011 07:27:00 -0000 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: 2011-02/txt/msg01492.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47708 --- Comment #1 from pinskia at gmail dot com 2011-02-12 06:36:09 UTC --- You are violating c/c++ aliasing rules.  The code is undefined. Sent from my Palm Pre on AT&T On Feb 11, 2011 22:27, zephyrtronium at gmail dot com <gcc-bugzilla@gcc.gnu.org> wrote: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47708 Summary: incorrect code on -O2 without -fno-tree-pre Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: zephyrtronium@gmail.com Created attachment 23310 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23310 minimal case gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.5.2/configure --enable-lto Thread model: posix gcc version 4.5.2 (GCC) Compiling the following minimal case on -O2 or -O3 and running results in incorrect output; with -O0, -O1, or -Os, it is correct. -O2 -fno-tree-pre results in correct output, but -O1 -ftree-pre is also correct. GCC 4.4.3 appears to work.