https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84213
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pmderodat at gcc dot gnu.org --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- .uleb128 0x7 # (DIE (0x56) DW_TAG_variable) .ascii "em1\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (t.f90) .byte 0x2 # DW_AT_decl_line .long 0x1a # DW_AT_type # DW_AT_external .uleb128 0x9 # DW_AT_location .byte 0x3 # DW_OP_addr .quad module_ra_gfdleta.eq.0_ and we get here via #2 0x0000000000af7740 in analyze_functions (first_time=true) at /space/rguenther/src/svn/early-lto-debug/gcc/cgraphunit.c:1256 1256 (*debug_hooks->late_global_decl) (node->decl); (gdb) l 1251 /* We are reclaiming totally unreachable code and variables 1252 so they effectively appear as readonly. Show that to 1253 the debug machinery. */ 1254 TREE_READONLY (node->decl) = 1; 1255 node->definition = false; 1256 (*debug_hooks->late_global_decl) (node->decl); 1257 } but the intent doesn't work because we have a DECL_VALUE_EXPR here... #1 0x0000000000b99a34 in dwarf2out_late_global_decl ( decl=<var_decl 0x7ffff7fefbd0 em1v>) at /space/rguenther/src/svn/early-lto-debug/gcc/dwarf2out.c:25750 (gdb) l 25745 they are relevant for debuggers. */ 25746 varpool_node *node = varpool_node::get (decl); 25747 if ((! node || ! node->definition) && ! DECL_HAS_VALUE_EXPR_P (decl)) 25748 tree_add_const_value_attribute_for_decl (die, decl); 25749 else 25750 add_location_or_const_value_attribute (die, decl, false); 25751 } 25752 } I didn't add this extra check but this breaks things here :/ Added by r248792.