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.