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

            Bug ID: 102723
           Summary: ICE in get_partitioning_class, at symtab.c:2092
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, lto
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

g++-12.0.0-alpha20211010 snapshot (g:74ccca380cde5e79e082d39214b306a90ded0344)
ICEs when compiling the following testcase, reduced from
test/SemaTemplate/instantiate-static-local.cpp from the clang 12.0.0 test
suite, w/ -flto:

template <int &R>
struct A {
  static constexpr int &value = R;
};

template <typename = void>
auto
S ()
{
  static int s;
  return A<s>{};
}

auto s = decltype (S ())::value;

% g++-12.0.0 -flto -c bxra81wv.cpp
during IPA pass: modref
bxra81wv.cpp:14:32: internal compiler error: in get_partitioning_class, at
symtab.c:2092
   14 | auto s = decltype (S ())::value;
      |                                ^
0x75e687 symtab_node::get_partitioning_class()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/symtab.c:2092
0xfe627b lto_output_varpool_node
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/lto-cgraph.c:620
0xfe627b output_symtab()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/lto-cgraph.c:987
0xffc874 lto_output()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/lto-streamer-out.c:2813
0x1089881 write_lto
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/passes.c:2680
0x1089881 ipa_write_summaries_1
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/passes.c:2744
0x1089881 ipa_write_summaries()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/passes.c:2800
0xcd95c2 ipa_passes
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/cgraphunit.c:2202
0xcd95c2 symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/cgraphunit.c:2289
0xcdc137 symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/cgraphunit.c:2269
0xcdc137 symbol_table::finalize_compilation_unit()
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211010/work/gcc-12-20211010/gcc/cgraphunit.c:2537

And g++ 11 ICEs differently:

during IPA pass: modref
bxra81wv.cpp:14:32: internal compiler error: tree code 'template_type_parm' is
not supported in LTO streams
   14 | auto s = decltype (S ())::value;
      |                                ^
0x164fe9c internal_error(char const*, ...)
0xba7403 DFS::DFS(output_block*, tree_node*, bool, bool, bool)
0xbd0da8 lto_output_tree(output_block*, tree_node*, bool, bool)
0xbb0c41 produce_asm_for_decls()
0x904b26 symbol_table::finalize_compilation_unit()

Reply via email to