This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Only handle DECL_ABSTRACT_ORIGIN for fndecls in IPA (PR ipa/60457)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>, Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Mar 2014 15:47:40 +0100
- Subject: [PATCH] Only handle DECL_ABSTRACT_ORIGIN for fndecls in IPA (PR ipa/60457)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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?
2014-03-10 Jakub Jelinek <jakub@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