This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25632] [4.0/4.1/4.2 Regression] ICE with const int copied into two different functions
- From: "rakdver at atrey dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jan 2006 23:24:55 -0000
- Subject: [Bug c++/25632] [4.0/4.1/4.2 Regression] ICE with const int copied into two different functions
- References: <bug-25632-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from rakdver at atrey dot karlin dot mff dot cuni dot cz 2006-01-03 23:24 -------
Subject: Re: [4.0/4.1/4.2 Regression] ICE with const int copied into two
different functions
> ------- Comment #7 from mark at codesourcery dot com 2006-01-03 23:01 -------
> 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.
>
> So, why not just do:
>
> return unshare_expr (decl);
>
> at the end of the function?
because that causes bootstrap failure --
fold_decl_constant_value does
tree const_expr = expr;
do
{
expr = fold_non_dependent_expr (const_expr);
const_expr = integral_constant_value (expr);
}
while (expr != const_expr);
and if constant_value_1 (called by integral_constant_value) unshares the
expression unconditionally (not only when it processes DECL_INITIAL),
this loop never ends.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25632