[Bug debug/51650] [4.7 regression] LTO ICE in dwarf2out_finish, at dwarf2out.c:22501 while building libxul
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 23 11:13:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51650
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-23 10:41:02 UTC ---
(In reply to comment #13)
> Reduced (it almost identical to the first testcase):
>
> struct T;
> class C
> {
> public:
> typedef ::T T;
> virtual void E();
> static T *m ()
> {
> static T *d;
> return d;
> }
> };
> int
> fn ()
> {
> C::m ();
> }
> int main() {}
>From the C++ frontend the sequence is that we call debug_hooks->function_decl
for C::m from rest_of_handle_final which creates the type DIE for T. With
LTO everything but main is optimized out, but we still emit debug info for
C::m::d via emit_debug_global_declarations () because we think C::m::d is
still live (for some reason ...).
That is, without LTO but with -fwhole-program we do not output
_ZZN1C1mEvE1d but with -flto we do (but we do not output C::m in either
case). That seems to be a missed optimization (at least), probably
caused by applying the whole-program assumption late at WPA time:
Marking local functions: fn m
Marking externally visible functions: main
Marking externally visible variables:
Needed variables: d
why is d needed?
Reclaiming functions: fn m
cgraph pre whole_program_function_and_variable_visibility time:
main/2 @0x7ffff5a29900 (asm: main) availability:available analyzed reachable
body externally_visible prevailing_def finalized
called by:
calls:
References:
Refering this function:
fn/1 @0x7ffff5a297e0 (asm: _Z2fnv) availability:available analyzed reachable
body externally_visible prevailing_def_ironly finalized
called by:
calls: m/0 (1.00 per call)
References:
Refering this function:
m/0 @0x7ffff5a296c0 (asm: _ZN1C1mEv) availability:available analyzed reachable
body externally_visible finalized
called by: fn/1 (1.00 per call)
calls:
References: var:d (read)
Refering this function:
it seems that m/0 lacks a resolution, the resolution file has
1
t.o 3
195 67dffb6b12d80baf PREVAILING_DEF_IRONLY _Z2fnv
200 67dffb6b12d80baf PREVAILING_DEF main
202 67dffb6b12d80baf PREVAILING_DEF_IRONLY _ZZN1C1mEvE1d
hm. And the function decl for m looks like
<function_decl 0x7ffff5b60c00 m
type <function_type 0x7ffff5b5f7e0
...
addressable used nothrow public static weak autoinline QI defer-output
...
and it is DECL_COMDAT, so we do not output it to the LTO IL symtab and
thus do not get a resolution for it from the first loop. In the
2nd loop we do not output it because the node isn't DECL_EXTERNAL either.
Why do we never output comdat unsharable functions and thus do not get
a resolution (which would be valid even if we end up unsharing them)?
More information about the Gcc-bugs
mailing list