public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/51650] [4.7 regression] LTO ICE in dwarf2out_finish, at dwarf2out.c:22501 while building libxul
Date: Fri, 23 Dec 2011 11:13:00 -0000	[thread overview]
Message-ID: <bug-51650-4-0UjH2oawz6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51650-4@http.gcc.gnu.org/bugzilla/>

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)?


  parent reply	other threads:[~2011-12-23 10:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 20:32 [Bug lto/51650] New: [4.7 regression] " markus at trippelsdorf dot de
2011-12-21 20:36 ` [Bug debug/51650] [4.7 regression] LTO " pinskia at gcc dot gnu.org
2011-12-22 11:44 ` rguenth at gcc dot gnu.org
2011-12-22 12:01 ` rguenth at gcc dot gnu.org
2011-12-22 12:21 ` rguenth at gcc dot gnu.org
2011-12-22 12:54 ` markus at trippelsdorf dot de
2011-12-22 13:18 ` rguenth at gcc dot gnu.org
2011-12-22 13:26 ` markus at trippelsdorf dot de
2011-12-22 13:34 ` markus at trippelsdorf dot de
2011-12-22 13:43 ` rguenth at gcc dot gnu.org
2011-12-22 15:32 ` rguenth at gcc dot gnu.org
2011-12-22 15:34 ` rguenth at gcc dot gnu.org
2011-12-22 15:37 ` markus at trippelsdorf dot de
2011-12-22 18:47 ` markus at trippelsdorf dot de
2011-12-22 19:24 ` markus at trippelsdorf dot de
2011-12-23  9:19 ` rguenth at gcc dot gnu.org
2011-12-23 11:13 ` rguenth at gcc dot gnu.org [this message]
2011-12-23 11:23 ` rguenth at gcc dot gnu.org
2011-12-23 11:46 ` rguenth at gcc dot gnu.org
2011-12-23 11:52 ` rguenth at gcc dot gnu.org
2011-12-23 13:34 ` rguenth at gcc dot gnu.org
2011-12-23 14:03 ` markus at trippelsdorf dot de
2012-01-02 15:53 ` rguenth at gcc dot gnu.org
2012-01-02 16:53 ` markus at trippelsdorf dot de
2012-01-03 11:31 ` rguenth at gcc dot gnu.org
2012-01-03 11:31 ` rguenth at gcc dot gnu.org
2012-01-04  1:13 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51650-4-0UjH2oawz6@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).