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 3, 2013 at 7:36 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On the following testcase we ICE with -fcompare-debug with
> --enable-checking=yes, because strip_typedefs copies args to a new TREE_VEC,
> but doesn't copy over NON_DEFAULT_TEMPLATE_ARGS_COUNT.  For ENABLE_CHECKING
> the code requires that it is set, for !ENABLE_CHECKING it would be needed
> only if NON_DEFAULT_TEMPLATE_ARGS_COUNT was already non-NULL (otherwise
> GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT would use length of the TREE_VEC).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8/4.7?
>
> 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?

-- Gaby


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