From patchwork Mon Sep 9 03:09:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 273477 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 264CA2C00A6 for ; Mon, 9 Sep 2013 13:09:18 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=e8ThwD+J2B7Xe92sqlr1jnU/t1pFEobPL4Xl4XS00Ngldm TrRck6SmpXYbprqyvlLwRFxC00jtAbYzVUNfBW/Gqzy+cs5rRZ/xhKUmlb5/afON O9A6A9SbegR4e/oOZXsoy7wV9PC68JNqhOJGvsw9FPWWijWXERSQGXXDpK28o= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=uBol19eQud0zXb9VJFHksy/vtYk=; b=mWYG/GFeZDapGQ//NLo+ srRPTt7J3AsDjSNgXSJlFfrzx11A9OmWSQsdUMkOePzo3hI7A8CNtptmDWZJXnSV LiIJycNwzTfET9i4+vX710A5gXIzl4WTiAEu07j/gLxWFvLfvne9LHaKNHwhc1m/ ESQrqutLLD7jkaOlCPSUiIg= Received: (qmail 21697 invoked by alias); 9 Sep 2013 03:09:10 -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 21681 invoked by uid 89); 9 Sep 2013 03:09:09 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Sep 2013 03:09:09 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r89396B5027852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 8 Sep 2013 23:09:06 -0400 Received: from stumpy.slc.redhat.com ([10.3.113.18]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r89396ql014630 for ; Sun, 8 Sep 2013 23:09:06 -0400 Message-ID: <522D3BD1.1050606@redhat.com> Date: Sun, 08 Sep 2013 21:09:05 -0600 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: gcc-patches Subject: PR bootstrap/58340 X-IsSubscribed: yes This fixes the problem noted by Zhendong in c#4. I'll be working through other reports of issues related to the tree-ssa-threadedge.c to see if there's any lingering problems. Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed onto the trunk. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f3e0b8..796b8eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-08 Jeff Law + + * tree-ssa-threadedge.c (thread_across_edge): Fix initialization + of 'found'. + 2013-09-08 Andi Kleen * tree-inline.c (estimate_num_insns): Limit asm cost to 1000. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 92eaeab..756611d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-09-08 Jeff Law + + * gcc.c-torture/compile/pr58340.c: New test. + 2013-09-08 Richard Sandiford * g++.dg/debug/ra1.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58340.c b/gcc/testsuite/gcc.c-torture/compile/pr58340.c new file mode 100644 index 0000000..ca3ccda --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr58340.c @@ -0,0 +1,16 @@ +int a, b, c, d; + +int foo (int x, int y) +{ + return y == 0 ? x : 1 % y; +} + +int main () +{ + c = 0 || a; + + for (;;) + b = foo (d, c) && 1; + + return 0; +} diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index afdd0af..f2051d7 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -978,7 +978,7 @@ thread_across_edge (gimple dummy_cond, { edge taken_edge; edge_iterator ei; - bool found = false; + bool found; bitmap visited = BITMAP_ALLOC (NULL); /* Look at each successor of E->dest to see if we can thread through it. */ @@ -994,6 +994,7 @@ thread_across_edge (gimple dummy_cond, of E->dest. */ path.safe_push (e); path.safe_push (taken_edge); + found = false; if ((e->flags & EDGE_DFS_BACK) == 0 || ! cond_arg_set_in_bb (path[path.length () - 1], e->dest)) found = thread_around_empty_blocks (taken_edge,