From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24841 invoked by alias); 13 Dec 2010 13:02:32 -0000 Received: (qmail 24832 invoked by uid 22791); 13 Dec 2010 13:02:31 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Mon, 13 Dec 2010 13:02:27 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/46909] [4.6 Regression] Logical OR expressions are miscompiled X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: blocker X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.0 X-Bugzilla-Changed-Fields: Status AssignedTo 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: Mon, 13 Dec 2010 13:02: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: 2010-12/txt/msg01401.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46909 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org |gnu.org | --- Comment #7 from Jakub Jelinek 2010-12-13 13:02:22 UTC --- The fix is easy: @@ -2441,7 +2441,7 @@ or_var_with_comparison_1 (gimple stmt, => (t OR inner2) If the partial result t is a constant, we win. Otherwise continue on to try reassociating with the other inner test. */ - if (innercode == TRUTH_OR_EXPR) + if (is_or) { if (integer_onep (t)) return boolean_true_node; @@ -2474,7 +2474,7 @@ or_var_with_comparison_1 (gimple stmt, /* Handle the OR case, where we are reassociating: (inner1 OR inner2) OR (op2a code2 op2b) => (inner1 OR t) */ - if (innercode == TRUTH_OR_EXPR) + if (is_or) { if (integer_zerop (t)) return inner1; (the and folder does it that way correctly). Still looking why it isn't optimized now into x != 4.