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

            Bug ID: 112638
           Summary: ICE: in add_dwarf_attr, at dwarf2out.cc:4501
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

*******************************************************************************
OS and Platform:
$ uname -a:
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
*******************************************************************************
Program:
$ cat prog.c
__seg_gs int var;

static int
*foo (void)
{
  int *addr;

  asm ("lea %p1, %0" : "=r"(addr) : "m"(var));

  return addr;
}

static int
bar (int *addr)
{
  int val;

  asm ("mov %%gs:%1, %0" : "=r"(val) : "m"(*addr));

  return val;
}

int
baz (void)
{
  int *addr = foo();
  int val = bar (addr);

  return val;
}
*******************************************************************************
Command Lines:
$ gcc -S -O2 -gdwarf-4 prog.c
prog.c:5:1: internal compiler error: in add_dwarf_attr, at dwarf2out.cc:4501
    5 | __seg_gs int var;
      | ^~~~~~~~
0x75d190 add_dwarf_attr
        ../../gcc/gcc/dwarf2out.cc:4501
0x75e79c add_dwarf_attr
        ../../gcc/gcc/vec.h:715
0x75e79c add_AT_string
        ../../gcc/gcc/dwarf2out.cc:4773
0x75e79c add_name_attribute(die_struct*, char const*)
        ../../gcc/gcc/dwarf2out.cc:21237
0x75e79c add_name_attribute(die_struct*, char const*)
        ../../gcc/gcc/dwarf2out.cc:21230
0xb8bfd9 modified_type_die
        ../../gcc/gcc/dwarf2out.cc:14028
0xb8d396 add_type_attribute
        ../../gcc/gcc/dwarf2out.cc:22361
0xb9ffda gen_variable_die
        ../../gcc/gcc/dwarf2out.cc:24678
0xb86188 gen_decl_die
        ../../gcc/gcc/dwarf2out.cc:27159
0xb876bb dwarf2out_decl
        ../../gcc/gcc/dwarf2out.cc:27652
0xb87a1c dwarf2out_early_global_decl
        ../../gcc/gcc/dwarf2out.cc:27299
0x95dc88 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
        ../../gcc/gcc/c/c-decl.cc:5833
0x9c5ba2 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:2743
0x9d0cfb c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:1997
0x9d16d5 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:1851
0x9d16d5 c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:25462
0xa43e01 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1278
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to