------- Comment #4 from rguenth at gcc dot gnu dot org 2010-04-30 11:42 ------- Without -fprofile-arcs we never output the decl copy (so it probably gets lost).
So this seems to be a latent problem with early inlining? At least the inlining before profiling sees { Scope block #0 extern void expand_expr_stmt (void); (unused) } expand_stmt_with_iterators_1 () { <bb 2>: expand_expr_stmt (); return; } but after inlining into iterator_expand that one has { Scope block #0 { Scope block #2 (unused) c-iterate.3.i:10 Originating from : static void expand_stmt_with_iterators_1 (void); { Scope block #3 Originating from :#0 } } } and regular early inlining is facing { Scope block #0 } expand_stmt_with_iterators_1 () { <bb 2>: expand_expr_stmt (); return; } even with -g, so we end up with the inlined block tree { Scope block #0 { Scope block #2 c-iterate.3.i:10 Originating from : static void expand_stmt_with_iterators_1 (void); { Scope block #3 Originating from :#0 } } } We reclaim unused functions before removing unused vars from the abstract scope blocks maybe so they stay after early inlining? But in the end it looks wrong that we dispose of this extra fancy declaration? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43946