[PATCH] [Annotalysis] Fix internal compiler error on template methods

Delesley Hutchins delesley@google.com
Thu Sep 29 21:22:00 GMT 2011


The ICE occurs when decl is a TEMPLATE_DECL; that's the corner case
that causes a problem.  The patch that you and Ollie suggest does stop
the ICE for our particular example; I assume because the template in
question is not a clone, and so the predicate fails further on.
However, I'm not convinced that it will work in all cases.  I wish I
could come up with a test case, but like I said, I don't understand
enough about clones to understand what's happening here.  If you are
confident that DECL_CLONED_FUNCTION_P is correct, then we can use
that; I personally had no such confidence.

  -DeLesley

On Thu, Sep 29, 2011 at 10:41 AM, Diego Novillo <dnovillo@google.com> wrote:
> On 11-09-29 13:21 , Delesley Hutchins wrote:
>>
>> I don't have a test case, but look at the definitions of the two
>> macros in cp/cp-tree.h. DECL_CLONED_FUNCTION_P calls
>> decl_cloned_function_p, passing true as the second argument,  while
>> DECL_CLONED_FUNCTION makes the same call, but passes false.  Now look
>> at the definition of  decl_cloned_function_p in cp/class.c.  If the
>> second argument is true, it will step into templates, and if it is
>> false, it won't.  Incidentally, the ICE occurs when
>> DECL_CLONED_FUNCTION is applied to a template function, so this is not
>> a hypothetical case.  :-)
>
> But notice that STRIP_TEMPLATE is a NOP when DECL is not a TEMPLATE_DECL.
>  So, I'm not sure where you saw it ICE.  We are already using this idiom all
> over the parser, so it would be great if you could produce a test case for
> the failure you have in mind.
>
> Incidentally, I applied the variant of the patch Ollie and I suggested and
> the testcase works fine with it (while it fails without the patch, of
> course).
>
>
> Diego.
>



-- 
DeLesley Hutchins | Software Engineer | delesley@google.com | 505-206-0315



More information about the Gcc-patches mailing list