https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112638
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |ice-on-valid-code CC| |jason at gcc dot gnu.org, | |rguenth at gcc dot gnu.org, | |rth at gcc dot gnu.org Component|c |debug Last reconfirmed| |2023-11-20 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. First added via #0 add_dwarf_attr ( die=<dw_die_ref 0x7ffff71e1190 DW_TAG_base_type <parent=0x7ffff7036280 DW_TAG_compile_unit>>, attr=0x7fffffffcc20) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:4491 #1 0x00000000010879bc in add_AT_string ( die=<dw_die_ref 0x7ffff71e1190 DW_TAG_base_type <parent=0x7ffff7036280 DW_TAG_compile_unit>>, attr_kind=DW_AT_name, str=0x7ffff70101c8 "int") at /space/rguenther/src/gcc/gcc/dwarf2out.cc:4773 #2 0x00000000010b34b4 in add_name_attribute ( die=<dw_die_ref 0x7ffff71e1190 DW_TAG_base_type <parent=0x7ffff7036280 DW_TAG_compile_unit>>, name_string=0x7ffff70101c8 "int") at /space/rguenther/src/gcc/gcc/dwarf2out.cc:21240 #3 0x000000000109d971 in modified_type_die ( type=<integer_type 0x7ffff71b7690 int>, cv_quals=0, reverse=false, context_die=<dw_die_ref 0x7ffff7036280 DW_TAG_compile_unit>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:14015 #4 0x000000000109cea2 in modified_type_die ( type=<integer_type 0x7ffff71b7690 int>, cv_quals=512, reverse=false, context_die=<dw_die_ref 0x7ffff7036280 DW_TAG_compile_unit>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:13806 #5 0x00000000010b5cdf in add_type_attribute ( object_die=<dw_die_ref 0x7ffff71e1140 DW_TAG_variable <parent=0x7ffff7036280 DW_TAG_compile_unit>>, type=<integer_type 0x7ffff71b7690 int>, cv_quals=0, reverse=false, context_die=<dw_die_ref 0x7ffff7036280 DW_TAG_compile_unit>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:22364 #6 0x00000000010bc49a in gen_variable_die ( decl=<var_decl 0x7ffff7019c60 var>, origin=<tree 0x0>, context_die=<dw_die_ref 0x7ffff7036280 DW_TAG_compile_unit>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:24681 #7 0x00000000010c4221 in gen_decl_die (decl=<var_decl 0x7ffff7019c60 var>, origin=<tree 0x0>, ctx=0x0, context_die=<dw_die_ref 0x7ffff7036280 DW_TAG_compile_unit>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:27162 #8 0x00000000010c5551 in dwarf2out_decl (decl=<var_decl 0x7ffff7019c60 var>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:27655 #9 0x00000000010c4763 in dwarf2out_early_global_decl ( decl=<var_decl 0x7ffff7019c60 var>) at /space/rguenther/src/gcc/gcc/dwarf2out.cc:27302 and then when finishing frame #4 again via /* This probably indicates a bug. */ name = TYPE_IDENTIFIER (type); add_name_attribute (mod_type_die, name ? IDENTIFIER_POINTER (name) : "__unknown__"); as we qualify with address-space quals. But the dwarf2out code looks at address-space qualifiers on POINTER and REFERENCE types only, so we possibly want to drop the address-space qualifiers for non-pointer/reference types. The following makes the testcase not ICE. Richard, do you remember how this should work? diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index d187be9b786..c26f30e9568 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13663,8 +13663,7 @@ modified_type_die (tree type, int cv_quals, bool reverse, struct array_descr_info info; /* Only these cv-qualifiers are currently handled. */ const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE - | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC | - ENCODE_QUAL_ADDR_SPACE(~0U)); + | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC); const bool reverse_base_type = need_endianity_attribute_p (reverse) && is_base_type (type); this particular line was added by James Bowman in r8-4385-ga297ccb52e0c89 but without a testcase. The original DWARF support for address-spaces also didn't come with testcases and 'var' doesn't get any qualification with the above (obviously). Should the DW_TAG_variable DIE be annotated instead of the 'int' type?