]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/37095 (Trouble with covariant return)
authorJakub Jelinek <jakub@redhat.com>
Tue, 2 Sep 2008 10:33:46 +0000 (12:33 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 2 Sep 2008 10:33:46 +0000 (12:33 +0200)
PR tree-optimization/37095
* cgraph.c (cgraph_node): When creating new cgraph node after
assembler_name_hash has been populated, record it in the hash
table.

* g++.dg/inherit/thunk9.C: New test.

From-SVN: r139887

gcc/ChangeLog
gcc/cgraph.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/thunk9.C [new file with mode: 0644]

index 7c4df92df85ef9fd9e8eb4a6878aa5d25651540f..f873898368a616b238e02530a19282e0895bb794 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/37095
+       * cgraph.c (cgraph_node): When creating new cgraph node after
+       assembler_name_hash has been populated, record it in the hash
+       table.
+
 2008-09-01  Paul Brook  <paul@codesourcery.com>
 
        * doc/invoke.texi: Document -mword-relocations.
index fdc156dfe33a646f58d088c021bd7b50eb169ac4..54d5fad23ee81c57ad00546d3d611a3bcf7ab292 100644 (file)
@@ -453,7 +453,21 @@ cgraph_node (tree decl)
       node->origin->nested = node;
       node->master_clone = node;
     }
-
+  if (assembler_name_hash)
+    {
+      void **aslot;
+      tree name = DECL_ASSEMBLER_NAME (decl);
+
+      aslot = htab_find_slot_with_hash (assembler_name_hash, name,
+                                       decl_assembler_name_hash (name),
+                                       INSERT);
+      /* We can have multiple declarations with same assembler name. For C++
+        it is __builtin_strlen and strlen, for instance.  Do we need to
+        record them all?  Original implementation marked just first one
+        so lets hope for the best.  */
+      if (*aslot == NULL)
+       *aslot = node;
+    }
   return node;
 }
 
index 83d310fba7bbbd93747c5502c2828ce48575bf30..2b4495cdc4e29f0ab9f5a2df2a8649a7c80211f5 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/37095
+       * g++.dg/inherit/thunk9.C: New test.
+
 2008-09-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/37228
diff --git a/gcc/testsuite/g++.dg/inherit/thunk9.C b/gcc/testsuite/g++.dg/inherit/thunk9.C
new file mode 100644 (file)
index 0000000..9eb9999
--- /dev/null
@@ -0,0 +1,14 @@
+// PR tree-optimization/37095
+// { dg-options "-O" }
+
+struct A
+{
+  virtual A *foo ();
+};
+
+struct B : virtual A
+{
+  virtual B *foo () { return 0; }
+};
+
+B b;