aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-09-10 11:42:25 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-09-10 11:42:25 +0000
commit90097c677180701eb96cce0628b50a76e6b36441 (patch)
tree46d887c0794b9f2103481de10160218783176e36
parentc7a3980a09b3f2d64162f55390ca5156f4dbf4d1 (diff)
downloadgcc-90097c677180701eb96cce0628b50a76e6b36441.zip
gcc-90097c677180701eb96cce0628b50a76e6b36441.tar.gz
gcc-90097c677180701eb96cce0628b50a76e6b36441.tar.bz2
re PR middle-end/41257 (Bogus error '*.LTHUNK0' aliased to undefined symbol '_ZN1CD1Ev')
2009-09-10 Richard Guenther <rguenther@suse.de> PR middle-end/41257 * cgraphunit.c (cgraph_emit_thunks): Emit thunks only for reachable nodes. (cgraph_finalize_compilation_unit): Compute reachability before emitting thunks. Properly process aliases before possibly removing unreachable nodes. * g++.dg/torture/pr41257-2.C: New testcase. From-SVN: r151592
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cgraphunit.c27
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr41257-2.C16
4 files changed, 49 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e2d86d..c85c486 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2009-09-10 Richard Guenther <rguenther@suse.de>
+ PR middle-end/41257
+ * cgraphunit.c (cgraph_emit_thunks): Emit thunks only for
+ reachable nodes.
+ (cgraph_finalize_compilation_unit): Compute reachability
+ before emitting thunks. Properly process aliases before
+ possibly removing unreachable nodes.
+
+2009-09-10 Richard Guenther <rguenther@suse.de>
+
PR middle-end/41254
* tree.c (struct free_lang_data_d): Add worklist member.
(find_decls_types_r): Push onto the worklist instead of recursing.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 0acc472..5551c72 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1036,7 +1036,8 @@ cgraph_emit_thunks (void)
emitted, but we cannot know that until the inliner and other
IPA passes have run (see the sequencing of the call to
cgraph_mark_functions_to_output in cgraph_optimize). */
- if (!DECL_EXTERNAL (n->decl))
+ if (n->reachable
+ && !DECL_EXTERNAL (n->decl))
lang_hooks.callgraph.emit_associated_thunks (n->decl);
}
}
@@ -1047,35 +1048,45 @@ cgraph_emit_thunks (void)
void
cgraph_finalize_compilation_unit (void)
{
+ timevar_push (TV_CGRAPH);
+
/* Do not skip analyzing the functions if there were errors, we
miss diagnostics for following functions otherwise. */
/* Emit size functions we didn't inline. */
finalize_size_functions ();
- /* Emit thunks, if needed. */
- if (lang_hooks.callgraph.emit_associated_thunks)
- cgraph_emit_thunks ();
-
/* Call functions declared with the "constructor" or "destructor"
attribute. */
cgraph_build_cdtor_fns ();
+ /* Mark alias targets necessary and emit diagnostics. */
+ finish_aliases_1 ();
+
if (!quiet_flag)
{
fprintf (stderr, "\nAnalyzing compilation unit\n");
fflush (stderr);
}
+ /* Gimplify and lower all functions, compute reachability and
+ remove unreachable nodes. */
+ cgraph_analyze_functions ();
+
+ /* Emit thunks for reachable nodes, if needed. */
+ if (lang_hooks.callgraph.emit_associated_thunks)
+ cgraph_emit_thunks ();
+
/* Mark alias targets necessary and emit diagnostics. */
finish_aliases_1 ();
- /* Gimplify and lower all functions. */
- timevar_push (TV_CGRAPH);
+ /* Gimplify and lower thunks. */
cgraph_analyze_functions ();
- timevar_pop (TV_CGRAPH);
+ /* Finally drive the pass manager. */
cgraph_optimize ();
+
+ timevar_pop (TV_CGRAPH);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e2266b..c3d6c52 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-10 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41257
+ * g++.dg/torture/pr41257-2.C: New testcase.
+
2009-09-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/28293
diff --git a/gcc/testsuite/g++.dg/torture/pr41257-2.C b/gcc/testsuite/g++.dg/torture/pr41257-2.C
new file mode 100644
index 0000000..230fa5d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr41257-2.C
@@ -0,0 +1,16 @@
+/* { dg-do link } */
+
+struct A
+{
+ virtual ~A();
+};
+
+struct B : virtual A
+{
+ virtual ~B() {}
+};
+
+int main()
+{
+ return 0;
+}