From patchwork Thu Mar 17 09:18:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 598950 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 3qQjTv0bbqz9sBG for ; Thu, 17 Mar 2016 20:19:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kMace5NI; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=PEzUIrNiSziZn5UbnKYQJIhH/GP/Cieqkx/RDDgwEz25IMFq8Q 2YgAoKA1L+skJlCJseAooXBRYs5WE5/26s0E/tQIDQpYnIq/73WFrhNprQ+GBQru JXkZqRSEAnIBeoUyCtE6Zy9kdGvzPaeaADZRKvstRDWY/2CkCIUuHIdqw= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=idPrO7OGJe1+UeZmouy6373HjmU=; b=kMace5NIkrQJmtSfwUEn S00kM/DOu+q9J/nDrn31Vpod+1IIIu5oKFPgLmHy6S8aQdKd7YitFXX5H1NvqqTo aiwxK7q2eqiYmLYouQLyGhZZeCOrmfZDsgH8K0iDxbqVXA5JN/49V2WxjXFdK35Q oTWN6U981DiTEppB5IGr/fI= Received: (qmail 31119 invoked by alias); 17 Mar 2016 09:19:03 -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 30679 invoked by uid 89); 17 Mar 2016 09:18:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:Thu, Hx-languages-length:1825, 2016-03-17 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 17 Mar 2016 09:18:37 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1agU4d-0003hT-Uv from Tom_deVries@mentor.com ; Thu, 17 Mar 2016 02:18:32 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Thu, 17 Mar 2016 09:18:26 +0000 To: Richard Biener CC: GCC Patches From: Tom de Vries Subject: [PATCH, PR70269] Set dump_file to NULL in cgraph_node::get_body Message-ID: <56EA764B.5050305@mentor.com> Date: Thu, 17 Mar 2016 10:18:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Hi, this patch fixes PR70269, an 5/6 regression. When compiling with "-O2 -fipa-pta -fdump-ipa-pta-graph" we try to initialize a graph dump file for ipa-cp, while the dump file is not enabled, which causes an ICE because dump_file_name is NULL. This condition in pass_init_dump_file enables the unnecessary initialization, because dump_file is non-NULL: ... if (initializing_dump && dump_file && (dump_flags & TDF_GRAPH) && cfun && (cfun->curr_properties & PROP_cfg)) ... The dump_file is non-NULL, but it's the dump file for ipa-pta, the pass that calls cgraph_node:get_body which triggers the ipa transform of ipa-cp. The patch fixes this by resetting dump_file to NULL in cgraph_node::get_body. OK for stage 4 trunk/5 branch if bootstrap and reg-test succeeds? Thanks, - Tom Set dump_file to NULL in cgraph_node::get_body 2016-03-17 Tom de Vries PR ipa/70269 * cgraph.c (cgraph_node::get_body): Set dump_file to NULL after save. * gcc.dg/pr70269.c: New test. --- gcc/cgraph.c | 1 + gcc/testsuite/gcc.dg/pr70269.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 518ef24..4804081 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3372,6 +3372,7 @@ cgraph_node::get_body (void) const char *saved_dump_file_name = dump_file_name; int saved_dump_flags = dump_flags; dump_file_name = NULL; + dump_file = NULL; push_cfun (DECL_STRUCT_FUNCTION (decl)); execute_all_ipa_transforms (); diff --git a/gcc/testsuite/gcc.dg/pr70269.c b/gcc/testsuite/gcc.dg/pr70269.c new file mode 100644 index 0000000..030cea1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70269.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-graph" } */ + +void +foo (void) +{ +}