This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix up strip_typedefs (PR debug/56819)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]