aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-02-26 16:32:41 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-02-26 16:32:41 -0500
commitc34396266f5296551b618feae6039b8ec6e7d766 (patch)
treeb4073e33f09dbfaea84baa3df0d7b5bb4a9a70b5
parentca7e759d96d6c0c046a6e20b066d86d070f65e35 (diff)
downloadgcc-c34396266f5296551b618feae6039b8ec6e7d766.zip
gcc-c34396266f5296551b618feae6039b8ec6e7d766.tar.gz
gcc-c34396266f5296551b618feae6039b8ec6e7d766.tar.bz2
re PR c++/60347 (r208153 breaks Firefox build)
PR c++/60347 PR lto/53808 * class.c (clone_function_decl): Don't note_vague_linkage_fn. * init.c (build_vtbl_address): Do it here. From-SVN: r208184
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/init.c8
-rw-r--r--gcc/testsuite/g++.dg/template/dtor9.C12
4 files changed, 24 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 41a0db6..1f35d2a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2014-02-26 Jason Merrill <jason@redhat.com>
+ PR c++/60347
+ PR lto/53808
+ * class.c (clone_function_decl): Don't note_vague_linkage_fn.
+ * init.c (build_vtbl_address): Do it here.
+
PR c++/59231
PR c++/11586
PR c++/14710
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f61dc9d..b46391b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4584,10 +4584,6 @@ clone_function_decl (tree fn, int update_method_vec_p)
destructor. */
if (DECL_VIRTUAL_P (fn))
{
- if (DECL_DEFAULTED_FN (fn) && flag_devirtualize)
- /* Make sure the destructor gets synthesized so that it can be
- inlined after devirtualization. */
- note_vague_linkage_fn (fn);
clone = build_clone (fn, deleting_dtor_identifier);
if (update_method_vec_p)
add_method (DECL_CONTEXT (clone), clone, NULL_TREE);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 194a797..3ae2b5c 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1123,7 +1123,13 @@ build_vtbl_address (tree binfo)
/* Figure out what vtable BINFO's vtable is based on, and mark it as
used. */
vtbl = get_vtbl_decl_for_binfo (binfo_for);
- TREE_USED (vtbl) = 1;
+ if (tree dtor = CLASSTYPE_DESTRUCTORS (DECL_CONTEXT (vtbl)))
+ if (!TREE_USED (vtbl) && DECL_VIRTUAL_P (dtor) && DECL_DEFAULTED_FN (dtor))
+ /* Make sure the destructor gets synthesized so that it can be
+ inlined after devirtualization even if the vtable is never
+ emitted. */
+ note_vague_linkage_fn (dtor);
+ TREE_USED (vtbl) = true;
/* Now compute the address to use when initializing the vptr. */
vtbl = unshare_expr (BINFO_VTABLE (binfo_for));
diff --git a/gcc/testsuite/g++.dg/template/dtor9.C b/gcc/testsuite/g++.dg/template/dtor9.C
new file mode 100644
index 0000000..fd71389
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dtor9.C
@@ -0,0 +1,12 @@
+// PR c++/60347
+
+struct A;
+
+template <class T>
+struct B
+{
+ T* p;
+ virtual ~B() { p->~T(); }
+};
+
+struct C: B<A> { };