https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101975

            Bug ID: 101975
           Summary: ICE with '-g' for x86 named address spaces
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
  Target Milestone: ---

Given:

    int __seg_fs f;
    int __seg_gs g;

..., we ICE when compiling with '-g':

    [...]/pr.c:3:1: internal compiler error: in add_dwarf_attr, at
dwarf2out.c:4465
        3 | int __seg_fs f;
          | ^~~

This is for '{ dg-do compile { target i?86-*-* x86_64-*-* } }' -- I have not
verified if similar problem exist for other targets that support address
spaces.

    #0  fancy_abort (file=file@entry=0x1fe35a0
"[...]/source-gcc/gcc/dwarf2out.c", line=line@entry=4465,
function=function@entry=0x1fefba8 <add_dwarf_attr(die_struct*,
dw_attr_struct*)::__FUNCTION__> "add_dwarf_attr") at
[...]/source-gcc/gcc/diagnostic.c:1961
    #1  0x0000000000a221bb in add_dwarf_attr (attr=<synthetic pointer>,
die=0x7ffff768a230) at [...]/source-gcc/gcc/dwarf2out.c:4465
    #2  add_AT_string (str=<optimized out>, attr_kind=DW_AT_name,
die=0x7ffff768a230) at [...]/source-gcc/gcc/dwarf2out.c:4725
    #3  add_name_attribute (die=die@entry=0x7ffff768a230,
name_string=<optimized out>) at [...]/source-gcc/gcc/dwarf2out.c:21005
    #4  0x0000000000a46580 in add_name_attribute (name_string=<optimized out>,
die=0x7ffff768a230) at [...]/source-gcc/gcc/dwarf2out.c:21000
    #5  modified_type_die (type=<optimized out>, cv_quals=<optimized out>,
reverse=reverse@entry=false, context_die=context_die@entry=0x7ffff7565140) at
[...]/source-gcc/gcc/dwarf2out.c:13873
    #6  0x0000000000a47834 in add_type_attribute
(object_die=object_die@entry=0x7ffff768a1e0, type=<optimized out>,
type@entry=0x7ffff7674dc8, cv_quals=<optimized out>,
reverse=reverse@entry=false, context_die=context_die@entry=0x7ffff7565140) at
[...]/source-gcc/gcc/dwarf2out.c:22134
    #7  0x0000000000a3b5c5 in gen_variable_die (decl=decl@entry=0x7ffff7fc3b40,
origin=<optimized out>, origin@entry=0x0,
context_die=context_die@entry=0x7ffff7565140) at
[...]/source-gcc/gcc/dwarf2out.c:24446
    #8  0x0000000000a3c38d in gen_decl_die (decl=decl@entry=0x7ffff7fc3b40,
origin=origin@entry=0x0, ctx=ctx@entry=0x0,
context_die=context_die@entry=0x7ffff7565140) at
[...]/source-gcc/gcc/dwarf2out.c:26895
    #9  0x0000000000a3d277 in dwarf2out_decl (decl=decl@entry=0x7ffff7fc3b40)
at [...]/source-gcc/gcc/dwarf2out.c:27385
    #10 0x0000000000a3d50c in dwarf2out_early_global_decl (decl=0x7ffff7fc3b40)
at [...]/source-gcc/gcc/dwarf2out.c:27035
    #11 0x00000000007bc142 in finish_decl (decl=decl@entry=0x7ffff7fc3b40,
init_loc=init_loc@entry=0, init=<optimized out>, init@entry=0x0,
origtype=origtype@entry=0x0, asmspec_tree=asmspec_tree@entry=0x0) at
[...]/source-gcc/gcc/c/c-decl.c:5537
    #12 0x00000000008366bd in c_parser_declaration_or_fndef
(parser=parser@entry=0x7ffff7fc3ab0, fndef_ok=false, fndef_ok@entry=true,
static_assert_ok=static_assert_ok@entry=true, empty_ok=empty_ok@entry=true,
nested=nested@entry=false, start_attr_ok=start_attr_ok@entry=true,
objc_foreach_object_declaration=0x0, omp_declare_simd_clauses=0x0,
have_attrs=<optimized out>, attrs=0x0, oacc_routine_data=0x0,
fallthru_attr_p=0x0) at [...]/source-gcc/gcc/c/c-parser.c:2375
    #13 0x0000000000840888 in c_parser_external_declaration
(parser=0x7ffff7fc3ab0) at [...]/source-gcc/gcc/c/c-parser.c:1778
    #14 0x000000000084115a in c_parser_translation_unit (parser=<optimized
out>) at [...]/source-gcc/gcc/c/c-parser.c:1651
    #15 c_parse_file () at [...]/source-gcc/gcc/c/c-parser.c:22272
    #16 0x00000000008af54d in c_common_parse_file () at
[...]/source-gcc/gcc/c-family/c-opts.c:1223
    #17 0x0000000000f3c73a in compile_file () at
[...]/source-gcc/gcc/toplev.c:458
    #18 0x0000000000794d13 in do_compile () at
[...]/source-gcc/gcc/toplev.c:2233
    #19 toplev::main (this=this@entry=0x7fffffffcf10, argc=argc@entry=35,
argv=argv@entry=0x7fffffffd028) at [...]/source-gcc/gcc/toplev.c:2372
    #20 0x000000000079aa37 in main (argc=35, argv=0x7fffffffd028) at
[...]/source-gcc/gcc/main.c:39

Reply via email to