aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
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 /gcc/cgraphunit.c
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
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c27
1 files changed, 19 insertions, 8 deletions
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);
}