http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48492

           Summary: [4.7 Regression] LTO bootstrap failure in
                    copy_constant
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ja...@gcc.gnu.org


Created attachment 23910
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23910
broken patch

../configure --enable-languages=all,obj-c++,ada,lto,go
--enable-checking=yes,rtl --with-build-config=bootstrap-lto
make -j64
fails with:
../../gcc/ada/ali.ads:39:1: internal compiler error: in copy_constant, at
varasm.c:3030
while linking gnatbind with -flto.
The problem is related to streaming out and in DECL_IN_CONSTANT_POOL var decls,
I guess in the original compilation it is streamed out normally, but when
it is streamed in, tree_output_constant_def isn't called on the DECL_INITIAL,
so it isn't registered with varpool and thus when streaming it out again,
varpool_get_node returns NULL and we stream the decl with DECL_IN_CONSTANT_POOL
set, but DECL_INITIAL being error_mark_node.  When it is streamed in again,
and expand_debug_expr calls mark_decl_rtl on it, it ICEs, because
error_mark_node isn't a constant.

I believe we need to stream DECL_IN_CONSTANT_POOL vars specially, basically
stream just the constants from its DECL_INITIAL and have the stream reader
call tree_output_constant_def for it.  Tried to do this in attached patch, but
probably it needs to be done slightly elsewhere, perhaps after after caching it
or whatever.  Not too familiar with the streamer...

Reply via email to