From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3761 invoked by alias); 28 Nov 2010 15:07:55 -0000 Received: (qmail 3751 invoked by uid 22791); 28 Nov 2010 15:07:54 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_ZJ 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; Sun, 28 Nov 2010 15:07:50 +0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/46675] [4.6 Regression] profiledbootstrap failed 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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.0 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: Sun, 28 Nov 2010 15:46: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-11/txt/msg03439.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46675 --- Comment #14 from Uros Bizjak 2010-11-28 15:07:39 UTC --- Hm, no. The patch in comment #13 is not correct fix. However, the comment of bound_difference says that no overflows are assumed: /* Stores the bounds on the value of the expression X - Y in LOOP to BNDS. The subtraction is considered to be performed in arbitrary precision, without overflows. We do not attempt to be too clever regarding the value ranges of X and Y; most of the time, they are just integers or ssa names offsetted by integer. However, we try to use the information contained in the comparisons before the loop (usually created by loop header copying). */ static void bound_difference (struct loop *loop, tree x, tree y, bounds *bnds) And we have an overflow here (slightly modified test): --cut here-- #define OFFS 1 extern void abort (void); int j; void __attribute__((noinline)) foo (int n) { int npairs, i; npairs = n - (-__INT_MAX__ - OFFS); if (npairs > 0) for (i = 0; i < npairs; i++) j++; } int main () { foo (5 - __INT_MAX__ - OFFS); if (j != 5) abort (); return 0; } --cut here-- An interesting fact, the testcase is miscompiled only for OFFS={1,2,3}.