Hi!

When building systemd with LTO and -g, we ICE, because we stream in
__PRETTY_FUNCTION__ VAR_DECL, which isn't referenced in the IL except for
BLOCK_VARS and thus doesn't get a varpool node streamed with it.
Later on when dwarf2out.c calls make_decl_rtl_for_debug on it, it creates
the varpool_node, but it has of course NULL lto_file_data, but
get_constructor assumes it isn't NULL.

Fixed thusly, bootstrapped/regtested on x86_64-linux, i686-linux and
aarch64-linux, tested it fixes systemd LTO -g build.
Acked by Honza privately on IRC, committed to trunk.

2015-02-19  Jakub Jelinek  <ja...@redhat.com>

        PR lto/65012
        * varpool.c (varpool_node::get_constructor): Return early
        if this->lto_file_data is NULL.

--- gcc/varpool.c.jj    2015-02-16 11:19:05.000000000 +0100
+++ gcc/varpool.c       2015-02-18 19:57:10.743001889 +0100
@@ -303,7 +303,8 @@ varpool_node::get_constructor (void)
   size_t len;
 
   if (DECL_INITIAL (decl) != error_mark_node
-      || !in_lto_p)
+      || !in_lto_p
+      || !lto_file_data)
     return DECL_INITIAL (decl);
 
   timevar_push (TV_IPA_LTO_CTORS_IN);

        Jakub

Reply via email to