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

            Bug ID: 97126
           Summary: gcc-9 and and above ICEs on 'no_unique_address':
                    internal compiler error: in
                    output_constructor_regular_field, at varasm.c:5402
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

ICE initially observed when building dolphin-emu with gcc-HEAD. Also affected
versions are: 9.3.0, 10.2.0.

Working version is 8.4.0, probably due to missing 'no_unique_address' attribute
support.

Minimal reproducer:

$ cat bug.cpp
struct b {
  constexpr b() : c() {}
  [[no_unique_address]] struct a {} c;
};
struct d {
  constexpr d() : c() {}
  int c;
};
struct e : b, d {};
class f {
  float g = 1.0f;
  e h;
} i;

$ ./xg++ -B. -std=c++17 -c bug.cpp -o bug.o
bug.cpp:13:4: internal compiler error: in output_constructor_regular_field, at
varasm.c:5402
   13 | } i;
      |    ^
0x15dfaae output_constructor_regular_field
        ../../gcc/gcc/varasm.c:5402
0x15e0a1b output_constructor
        ../../gcc/gcc/varasm.c:5708
0x15df0bf output_constant
        ../../gcc/gcc/varasm.c:5217
0x15dfdf5 output_constructor_regular_field
        ../../gcc/gcc/varasm.c:5441
0x15e0a1b output_constructor
        ../../gcc/gcc/varasm.c:5708
0x15df0bf output_constant
        ../../gcc/gcc/varasm.c:5217
0x15d3b6d assemble_variable_contents
        ../../gcc/gcc/varasm.c:2123
0x15d45f7 assemble_variable(tree_node*, int, int, int)
        ../../gcc/gcc/varasm.c:2302
0x15f1d4e varpool_node::assemble_decl()
        ../../gcc/gcc/varpool.c:587
0x9b8aa4 cgraph_order_sort::process()
        ../../gcc/gcc/cgraphunit.c:2557
0x9b8da1 output_in_order
        ../../gcc/gcc/cgraphunit.c:2622
0x9b93d8 symbol_table::compile()
        ../../gcc/gcc/cgraphunit.c:2840
0x9b97de symbol_table::finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:3021
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Compiler:

$ ./xg++ -B. -v
Reading specs from /home/slyfox/dev/git/gcc-native-quick-ggdb3/gcc/specs
COLLECT_GCC=/home/slyfox/dev/git/gcc-native-quick-ggdb3/gcc/xg++
COLLECT_LTO_WRAPPER=/home/slyfox/dev/git/gcc-native-quick-ggdb3/gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--enable-languages=c,c++ --disable-bootstrap --with-multilib-list=m64
--prefix=/home/slyfox/dev/git/gcc-native-quick-ggdb3/../gcc-native-quick-installed-ggdb3
--disable-nls --without-isl --disable-libsanitizer --disable-libvtv
--disable-libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions
CFLAGS='-O0 -ggdb3 ' CXXFLAGS='-O0 -ggdb3 ' --enable-valgrind-annotations
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20200920 (experimental) (GCC)

Reply via email to