From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14243 invoked by alias); 3 Jan 2006 23:29:16 -0000 Received: (qmail 14174 invoked by alias); 3 Jan 2006 23:29:14 -0000 Date: Tue, 03 Jan 2006 23:29:00 -0000 Message-ID: <20060103232914.14173.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/25632] [4.0/4.1/4.2 Regression] ICE with const int copied into two different functions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rakdver at atrey dot karlin dot mff dot cuni dot cz" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg00308.txt.bz2 List-Id: ------- Comment #9 from rakdver at atrey dot karlin dot mff dot cuni dot cz 2006-01-03 23:29 ------- Subject: Re: [4.0/4.1/4.2 Regression] ICE with const int copied into two different functions > rakdver at gcc dot gnu dot org wrote: > > ------- Comment #6 from rakdver at gcc dot gnu dot org 2006-01-03 22:40 ------- > > Patch: > > > > http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00136.html > > This patch is not OK, but it's close. > > We should not call unshare_expr on DECL_INITIAL until after the > mark_used call, as static data members in templates will not have proper > initializers until after that point. Also, there's no need to unshare > *before* calling fold_non_dependent_expr. > > In fact, there's no need to unshare before the return statement at the > end of the function. That will avoid creating trees that will only be > thrown away later. what about this patch, then (assuming it passes testing)? Index: cp/init.c =================================================================== *** cp/init.c (revision 109271) --- cp/init.c (working copy) *************** constant_value_1 (tree decl, bool integr *** 1503,1508 **** --- 1503,1510 ---- mark_used (decl); init = DECL_INITIAL (decl); } + init = unshare_expr (init); + if (!(init || init == error_mark_node) || !TREE_TYPE (init) || (integral_p -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25632