From patchwork Mon Jun 23 15:12:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 362972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E72281400AA for ; Tue, 24 Jun 2014 01:13:19 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Ctj6zXLA3vJZwqL4HM6yZL9yzfWmkAUgVOWq2zu7Ec/QuOjGdo9DV 999WSxGkT0Sk3063bjSpkPKWH85dQ8U/s7SvUas7ahkB6ACtlb0XoPsRSAk3G8zl xYTzFQ5h+f8E0//wxBECfxl8EJbA/JmaCwi3BVpxEUIbt8tdHXnlh0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=rgWLMwGaWc8ZWOH+EMYAaaWzZ8A=; b=OYC1EfXCBL78FGjFHvy8 00PHBF7Bs0y0rEK2xGMLxzd+8NYd7saUnh5mvRqUby23MjVrm3tRVV51gW0LAZk4 tsA4nIW1F6S1WDocttGhcRVDo6qZbS1AwiN6/GF5E+ETOBNyTJG4B5KGti3us1kK u5zHUq3dGwP5sHSmOjiv/3M= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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: Tue, 24 Jun 2014 00:42:39 +0930 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-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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); +}