From patchwork Sat Sep 18 00:15:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 65117 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 B747AB70AB for ; Sat, 18 Sep 2010 10:15:42 +1000 (EST) Received: (qmail 28361 invoked by alias); 18 Sep 2010 00:15:41 -0000 Received: (qmail 28352 invoked by uid 22791); 18 Sep 2010 00:15:40 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Sep 2010 00:15:34 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 17 Sep 2010 17:15:33 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga002.fm.intel.com with ESMTP; 17 Sep 2010 17:15:33 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 03F94207F1; Fri, 17 Sep 2010 17:15:32 -0700 (PDT) Date: Fri, 17 Sep 2010 17:15:32 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org, Jason Merrill , Richard Guenther Subject: Re: RFC: PATCH: PR c++/45709: [4.3/4.4/4.5/4.6 regression] internal compiler error: in add_phi_arg, at tree-phinodes.c:395 Message-ID: <20100918001532.GA26539@intel.com> Reply-To: "H.J. Lu" References: <20100917224910.GA24823@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100917224910.GA24823@intel.com> User-Agent: Mutt/1.5.20 (2009-12-10) 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 Fri, Sep 17, 2010 at 03:49:10PM -0700, H.J. Lu wrote: > Hi, > > This patch reverts the build_aggr_init change in revision 127647: > > http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00541.html > > Does it make any senses? > > Thanks. > > I missed another part. H.J. --- gcc/ 2010-09-17 H.J. Lu PR c++/45709 * init.c (build_aggr_init): Properly set type. gcc/testsuite/ 2010-09-17 H.J. Lu PR c++/45709 * g++.dg/torture/pr45709.C: New. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 189bcbe..355b8c1 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1316,6 +1316,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) /* Just know that we've seen something for this node. */ TREE_USED (exp) = 1; + TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); is_global = begin_init_stmts (&stmt_expr, &compound_stmt); destroy_temps = stmts_are_full_exprs_p (); current_stmt_tree ()->stmts_are_full_exprs_p = 0; @@ -1323,6 +1324,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) init, LOOKUP_NORMAL|flags, complain); stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt); current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps; + TREE_TYPE (exp) = type; TREE_READONLY (exp) = was_const; TREE_THIS_VOLATILE (exp) = was_volatile; --- /dev/null 2010-09-09 09:16:30.485584932 -0700 +++ gcc/gcc/testsuite/g++.dg/torture/pr45709.C 2010-09-17 15:15:22.000000000 -0700 @@ -0,0 +1,17 @@ +struct Region { + int storage[4]; + int count; +}; +static inline Region subtract(int lhs) +{ + Region reg; + int* storage = reg.storage; + if (lhs > 0) + storage++; + reg.count = storage - reg.storage; + return reg; +} +void bar(int a) +{ + const Region copyBack(subtract(a)); +}