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]

[PATCH] Only handle DECL_ABSTRACT_ORIGIN for fndecls in IPA (PR ipa/60457)


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


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