On Mon, 10 Mar 2014, Jakub Jelinek wrote:

> Hi!
> 
> From the comments on gcc-patches and from what the then block does
> I think only FUNCTION_DECLs were meant to be handled this way, but as the
> testcase shows we can trigger it even with VAR_DECLs.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

Ok.

Thanks,
Richard.

> 2014-03-10  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR ipa/60457
>       * ipa.c (symtab_remove_unreachable_nodes): Don't call
>       cgraph_get_create_node on VAR_DECLs.
> 
>       * g++.dg/ipa/pr60457.C: New test.
> 
> --- gcc/ipa.c.jj      2014-03-03 08:24:32.000000000 +0100
> +++ gcc/ipa.c 2014-03-07 17:27:20.193696625 +0100
> @@ -354,7 +354,8 @@ symtab_remove_unreachable_nodes (bool be
>       node->aux = (void *)2;
>        else
>       {
> -       if (DECL_ABSTRACT_ORIGIN (node->decl))
> +       if (TREE_CODE (node->decl) == FUNCTION_DECL
> +           && DECL_ABSTRACT_ORIGIN (node->decl))
>           {
>             struct cgraph_node *origin_node
>             = cgraph_get_create_node (DECL_ABSTRACT_ORIGIN (node->decl));
> --- gcc/testsuite/g++.dg/ipa/pr60457.C.jj     2014-03-07 17:32:26.517037376 
> +0100
> +++ gcc/testsuite/g++.dg/ipa/pr60457.C        2014-03-07 17:32:10.000000000 
> +0100
> @@ -0,0 +1,17 @@
> +// PR ipa/60457
> +// { dg-do compile }
> +
> +template <class T>
> +struct A
> +{
> +};
> +
> +struct B : A <B>
> +{
> +  B ();
> +};
> +
> +B::B ()
> +{
> +  const int c[] = { 1, 1 };
> +}
> 
>       Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer

Reply via email to