aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-02-05 22:54:06 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-02-05 22:54:06 +0100
commite6e1c050c5b545eeb8644b65e421e0dab61a7c08 (patch)
tree455a7dd2b93b6aa29952096e28035c3b04b31ee9
parent65a74b5d5b6b36052ca989c82e329b52a55121ff (diff)
downloadgcc-e6e1c050c5b545eeb8644b65e421e0dab61a7c08.zip
gcc-e6e1c050c5b545eeb8644b65e421e0dab61a7c08.tar.gz
gcc-e6e1c050c5b545eeb8644b65e421e0dab61a7c08.tar.bz2
re PR c++/39106 (aliased to undefined symbol error with thunks)
PR c++/39106 * cgraphunit.c (cgraph_function_versioning): Clear also DECL_VIRTUAL_P on the copied decl. * g++.dg/opt/thunk3.C: New test. From-SVN: r143973
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cgraphunit.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/thunk3.C48
4 files changed, 61 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8d6685..92bb49c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/39106
+ * cgraphunit.c (cgraph_function_versioning): Clear also DECL_VIRTUAL_P
+ on the copied decl.
+
2009-02-05 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/39110
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index cd58c2a..586ed61 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1551,10 +1551,11 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
TREE_PUBLIC (new_version_node->decl) = 0;
DECL_COMDAT (new_version_node->decl) = 0;
DECL_WEAK (new_version_node->decl) = 0;
+ DECL_VIRTUAL_P (new_version_node->decl) = 0;
new_version_node->local.externally_visible = 0;
new_version_node->local.local = 1;
new_version_node->lowered = true;
-
+
/* Update the call_expr on the edges to call the new version node. */
update_call_expr (new_version_node);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6299f28..dc1c009 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/39106
+ * g++.dg/opt/thunk3.C: New test.
+
2009-02-05 Nick Clifton <nickc@redhat.com>
* gcc.c-torture/compile/20080625-1.c: Skip for M32C.
diff --git a/gcc/testsuite/g++.dg/opt/thunk3.C b/gcc/testsuite/g++.dg/opt/thunk3.C
new file mode 100644
index 0000000..bfd6874
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/thunk3.C
@@ -0,0 +1,48 @@
+// PR c++/39106
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+struct A
+{
+ A (bool x = true);
+};
+class B
+{
+ virtual bool bar (A &, int) const =0;
+};
+class C : virtual public B
+{
+};
+struct D : virtual public B
+{
+ bool bar (A &, int) const;
+};
+template <int N>
+struct E : public D
+{
+ bool bar (A &x, int y) const
+ {
+ return baz().bar (x, y);
+ }
+ const D & baz () const;
+};
+extern template class E<0>;
+
+void
+foo ()
+{
+ try
+ {
+ A a;
+ abort ();
+ } catch (...)
+ {
+ }
+ A b;
+ E<0> c;
+ c.bar (b, 3);
+ E<0> d;
+ d.bar (b, 3);
+}