From patchwork Sat Dec 8 15:51:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Don't drop DECL_INITIAL if -g for DWARF2+ (PR fortran/55395) From: Eric Botcazou X-Patchwork-Id: 204672 Message-Id: <2566667.Dv0IlRhJMA@polaris> To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org, Jan Hubicka , Jan Hubicka , Richard Biener Date: Sat, 08 Dec 2012 16:51:57 +0100 > > OK. How we want to handle this with LTO streaming? > > Don't know. From debug info quality POV right now, LTO has lots of other > more important issues first. And from the invalid error POV, that only > matters if the initializer changes in between RTL expansion of some function > and end of compilation, so could be fine for now. If not C++-style const, > the DECL_INITIAL is used only in the CUs where the definition of the symbol > is emitted or would be emitted anyway. This breaks LTO bootstrap with Ada enabled though, because the following DECL_IN_CONSTANT_POOL variable has had its DECL_INITIAL wrongly reset: (gdb) p debug_tree(decl) unit size align 32 symtab -152784816 alias set 38 canonical type 0x7ffff6e46bd0 fields nonaddressable SI file line 0 col 0 size unit size align 32 offset_align 128 offset bit offset context chain > pointer_to_this chain > readonly addressable static ignored in-constant-pool DI file (null) line 0 col 0 size unit size align 32 initial > so I've installed the attached patch as obvious after testing on x86-64/Linux. 2012-12-08 Eric Botcazou * lto-streamer-out.c (lto_write_tree): Do not reset the DECL_INITIAL of variables in the global contant pool. Index: lto-streamer-out.c =================================================================== --- lto-streamer-out.c (revision 194319) +++ lto-streamer-out.c (working copy) @@ -328,6 +328,7 @@ lto_write_tree (struct output_block *ob, tree initial = DECL_INITIAL (expr); if (TREE_CODE (expr) == VAR_DECL && (TREE_STATIC (expr) || DECL_EXTERNAL (expr)) + && !DECL_IN_CONSTANT_POOL (expr) && initial) { lto_symtab_encoder_t encoder;