aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-02 12:33:46 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-02 12:33:46 +0200
commit1aeaf0f764b0be261e12be19f8b73977440994cb (patch)
tree429456a11bd954fe29706c1e6896e3981d44fd2a
parent900e887f6d2dd21c118f5de7cbcf3d56173a02a7 (diff)
downloadgcc-1aeaf0f764b0be261e12be19f8b73977440994cb.zip
gcc-1aeaf0f764b0be261e12be19f8b73977440994cb.tar.gz
gcc-1aeaf0f764b0be261e12be19f8b73977440994cb.tar.bz2
re PR tree-optimization/37095 (Trouble with covariant return)
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cgraph.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/inherit/thunk9.C14
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7c4df92d..f873898 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index fdc156d..54d5fad 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 83d310f..2b4495c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..9eb9999
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/thunk9.C
@@ -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;