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
This commit is contained in:
Richard Guenther 2009-09-10 11:42:25 +00:00 committed by Richard Biener
parent c7a3980a09
commit 90097c6771
4 changed files with 49 additions and 8 deletions

View file

@ -1,3 +1,12 @@
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

View file

@ -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);
}

View file

@ -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

View file

@ -0,0 +1,16 @@
/* { dg-do link } */
struct A
{
virtual ~A();
};
struct B : virtual A
{
virtual ~B() {}
};
int main()
{
return 0;
}