From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3725 invoked by alias); 23 Jun 2014 15:13:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3706 invoked by uid 89); 23 Jun 2014 15:13:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f52.google.com Received: from mail-pb0-f52.google.com (HELO mail-pb0-f52.google.com) (209.85.160.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 23 Jun 2014 15:12:47 +0000 Received: by mail-pb0-f52.google.com with SMTP id rq2so5999276pbb.39 for ; Mon, 23 Jun 2014 08:12:45 -0700 (PDT) X-Received: by 10.66.228.133 with SMTP id si5mr30172425pac.48.1403536364575; Mon, 23 Jun 2014 08:12:44 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by mx.google.com with ESMTPSA id yv7sm94992118pac.33.2014.06.23.08.12.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 08:12:43 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 53540EA5104; Tue, 24 Jun 2014 00:42:39 +0930 (CST) Date: Mon, 23 Jun 2014 15:13:00 -0000 From: Alan Modra To: gcc-patches@gcc.gnu.org Subject: PR61583, stage2 and stage3 compare failure due to value range loss Message-ID: <20140623151239.GQ3462@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg01781.txt.bz2 This fixes a bootstrap compare failure on current mainline and 4.9 branch configured with --disable-checking, caused by losing value range info when outputting debug info. Lack of value range info leads to loop bounds not being calculated, which in turn means a "j < n" test is not converted to "j != n". Details in the PR. Bootstrapped and regression tested powerpc64-linux, and committed with Jakub's approval. gcc/ PR bootstrap/61583 * tree-vrp.c (remove_range_assertions): Do not set is_unreachable to zero on debug statements. gcc/testsuite/ * gcc.dg/pr61583.c: New. Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c (revision 211886) +++ gcc/tree-vrp.c (working copy) @@ -6523,8 +6523,9 @@ remove_range_assertions (void) } else { + if (!is_gimple_debug (gsi_stmt (si))) + is_unreachable = 0; gsi_next (&si); - is_unreachable = 0; } } } Index: gcc/testsuite/gcc.dg/pr61583.c =================================================================== --- gcc/testsuite/gcc.dg/pr61583.c (revision 0) +++ gcc/testsuite/gcc.dg/pr61583.c (revision 0) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +void +f1 (int n, int b) +{ + extern void f2 (int); + int j; + + if (b) + n = 1; + + if (n < 1) + __builtin_unreachable (); + + for (j = 0; j < n; j++) + f2 (j); +} -- Alan Modra Australia Development Lab, IBM