This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix up strip_typedefs (PR debug/56819)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Jason Merrill <jason at redhat dot com>, Dodji Seketeli <dseketel at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 3 Apr 2013 15:45:37 +0200
- Subject: Re: [C++ PATCH] Fix up strip_typedefs (PR debug/56819)
- References: <20130403123600 dot GC4201 at tucnak dot redhat dot com> <CAAiZkiBqOfnrL8Fmk91JB4tj-7u297Q0Bft7u12sfeU=xg5j0g at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Apr 03, 2013 at 08:38:01AM -0500, Gabriel Dos Reis wrote:
> > 2013-04-03 Jakub Jelinek <jakub@redhat.com>
> >
> > PR debug/56819
> > * tree.c (strip_typedefs): SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
> > on new_args.
> >
> > * g++.dg/debug/pr56819.C: New test.
> >
> > --- gcc/cp/tree.c.jj 2013-04-02 20:24:34.000000000 +0200
> > +++ gcc/cp/tree.c 2013-04-03 10:51:56.614548181 +0200
> > @@ -1255,8 +1255,16 @@ strip_typedefs (tree t)
> > changed = true;
> > }
> > if (changed)
> > - fullname = lookup_template_function (TREE_OPERAND (fullname, 0),
> > - new_args);
> > + {
> > +#ifndef ENABLE_CHECKING
> > + if (NON_DEFAULT_TEMPLATE_ARGS_COUNT (args))
> > +#endif
> > + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
> > + (new_args, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (args));
> > + fullname
> > + = lookup_template_function (TREE_OPERAND (fullname, 0),
> > + new_args);
> > + }
> > else
> > ggc_free (new_args);
>
> Hmm, the resulting code does not look simpler.
> Why can't we always copy the stuff as opposed to
> playing cat-n-fish with the CPP macro ENABLE_CHECKING?
I didn't want to slow it down in the common case (--enable-checking=release)
and null NON_DEFAULT_TEMPLATE_ARGS_COUNT, in that case it would
build_int_cst unnecessarily. If that isn't something we care about, why are
we differentiating between ENABLE_CHECKING vs. !ENABLE_CHECKING for
*NON_DEFAULT_TEMPLATE_ARGS_COUNT everywhere at all?
Though, as INTEGER_CSTs should be shared, perhaps this could be just
NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_args)
= NON_DEFAULT_TEMPLATE_ARGS_COUNT (args);
and strip_typedefs_expr could be changed to do the same thing.
Jakub