From patchwork Tue May 3 18:18:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 93870 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]) by ozlabs.org (Postfix) with SMTP id 4A783B6F06 for ; Wed, 4 May 2011 04:19:16 +1000 (EST) Received: (qmail 28316 invoked by alias); 3 May 2011 18:19:14 -0000 Received: (qmail 28307 invoked by uid 22791); 3 May 2011 18:19:14 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 18:18:54 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p43IIseS022544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 3 May 2011 14:18:54 -0400 Received: from [127.0.0.1] (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p43IIrDC016626; Tue, 3 May 2011 14:18:53 -0400 Message-ID: <4DC0470D.9090303@redhat.com> Date: Tue, 03 May 2011 14:18:53 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Diego Novillo CC: gcc-patches@gcc.gnu.org Subject: RFA Re: C++ PATCHes relating to c++/48834, c++/40975 (array new) References: <4DBF2909.4050207@redhat.com> <201105030900.59716.ebotcazou@adacore.com> <4DC01EC5.8010904@redhat.com> <201105031752.31600.ebotcazou@adacore.com> <4DC03B43.4060705@redhat.com> In-Reply-To: <4DC03B43.4060705@redhat.com> 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 On 05/03/2011 01:28 PM, Jason Merrill wrote: > stor-layout.c (copy_self_referential_tree_r): Affected by the change. > Would you like me to add a gcc_unreachable() here? > > tree-inline.c (copy_tree_body_r): already copies STATEMENT_LIST itself > (with a copy_statement_list function which I should use instead of > open-coding it again). Thus. Tested x86_64-pc-linux-gnu with c,ada,c++,fortran,java,lto,objc. OK? I also removed the recursion from copy_statement_list because it would just extra garbage STATEMENT_LISTs since they're already copied by the normal walk_tree. Jason commit 85aad99f6848bfaebbe5c794bf0a95c80e0f49cd Author: Jason Merrill Date: Tue May 3 13:19:10 2011 -0400 PR c++/40975 * tree-inline.c (copy_tree_r): Use copy_statement_list. (copy_statement_list): Don't recurse. * stor-layout.c (copy_self_referential_tree_r): Don't allow STATEMENT_LIST. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index ea0d44d..ecd1450 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -245,6 +245,8 @@ copy_self_referential_tree_r (tree *tp, int *walk_subtrees, void *data) cannot always guarantee in practice. So punt in this case. */ else if (code == SAVE_EXPR) return error_mark_node; + else if (code == STATEMENT_LIST) + gcc_unreachable (); return copy_tree_r (tp, walk_subtrees, data); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3777675..ea7b7ab 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -662,8 +662,6 @@ copy_statement_list (tree *tp) for (; !tsi_end_p (oi); tsi_next (&oi)) { tree stmt = tsi_stmt (oi); - if (TREE_CODE (stmt) == STATEMENT_LIST) - copy_statement_list (&stmt); tsi_link_after (&ni, stmt, TSI_CONTINUE_LINKING); } } @@ -4272,19 +4270,9 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) *tp = new_tree; } else if (code == STATEMENT_LIST) - { - /* We used to just abort on STATEMENT_LIST, but we can run into them - with statement-expressions (c++/40975). */ - tree new_list = alloc_stmt_list (); - tree_stmt_iterator i = tsi_start (*tp); - tree_stmt_iterator j = tsi_last (new_list); - for (; !tsi_end_p (i); tsi_next (&i)) - { - tree stmt = tsi_stmt (i); - tsi_link_after (&j, stmt, TSI_CONTINUE_LINKING); - } - *tp = new_list; - } + /* We used to just abort on STATEMENT_LIST, but we can run into them + with statement-expressions (c++/40975). */ + copy_statement_list (tp); else if (TREE_CODE_CLASS (code) == tcc_type) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_declaration)