This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49945] [4.7 Regression] gcc.dg/guality/vla-1.c FAILs with -flto
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 25 Nov 2011 09:59:31 +0000
- Subject: [Bug middle-end/49945] [4.7 Regression] gcc.dg/guality/vla-1.c FAILs with -flto
- Auto-submitted: auto-generated
- References: <bug-49945-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49945
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-25 09:59:31 UTC ---
This is a bug in lto-streamer-out.c. TYPE_MAXVAL of the ARRAY_TYPE's
TYPE_DOMAIN e.g. in f1 is a VAR_DECL (DECL_NAME is NULL, DECL_ARTIFICIAL, but
!DECL_IGNORED_P). It is first encountered in a GIMPLE_DEBUG's first operand,
it hasn't been seen yet, so that VAR_DECL is output. But, later on
write_global_stream calls lto_output_tree on the VLA ARRAY_TYPE, with ref_p set
to false, and this eventually calls lto_output_tree on that VAR_DECL again.
But this doesn't find it in ob->writer_cache, because the cache has been
destroyed in between, from output_function -> destroy_output_block ->
lto_streamer_cache_delete.
I guess VLA types need to be emitted immediately in the containing function,
rather than being deferred to be written much later on globally.