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

            Bug ID: 120273
           Summary: [15/16 regression] ICE when building corral
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: c++-coroutines, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Originally reported downstream in Gentoo at https://bugs.gentoo.org/955934 when
building 'corral'. The user reported it with GCC 14 but I can't reproduce that
yet.

What they hit is:
```
[1/2] Building CXX object CMakeFiles/corral_basic_test.dir/test/basic_test.cc.o
FAILED: CMakeFiles/corral_basic_test.dir/test/basic_test.cc.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DCATCH_CONFIG_MAIN
-I/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27
 -O2 -pipe -march=x86-64-v3 -ggdb3 -std=c++20 -MD -MT
CMakeFiles/corral_basic_test.dir/test/basic_test.cc.o -MF
CMakeFiles/corral_basic_test.dir/test/basic_test.cc.o.d -o
CMakeFiles/corral_basic_test.dir/test/basic_test.cc.o -c
/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27/test/basic_test.cc
In file included from
/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27/test/../corral/corral.h:30,
                 from
/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27/test/basic_test.cc:36:
/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27/test/../corral/Nursery.h:
I
n function ‘void
corral::BasicNursery<corral::UseExceptions>::makePromise<corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int),
{anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test*,
std::reference_wrapper<TestEventLoop>, int>(corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int),
{anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test*,
std::reference_wrapper<TestEventLoop>, int)::<lambda(corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int), auto:62, auto:63
...)>::operator()(corral::BasicNursery<corral::UseExceptions>::makePromise<corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int),
{anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test*,
std::reference_wrapper<TestEventLoop>, int>(corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int),
{anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test*,
std::reference_wrapper<TestEventLoop>, int)::<lambda(corral::Task<void>
({anonymous}::test_body_133(test_body_133(TestEventLoop&)::_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.Frame*)::Test::*)(TestEventLoop&,
int), auto:62, auto:63
...)>::_ZZN6corral12BasicNurseryINS_13UseExceptionsEE11makePromiseIMZN12_GLOBAL__N_113test_body_133EPZNS4_L13test_body_133ER13TestEventLoopE56_ZN12_GLOBAL__N_1L13test_body_133ER13TestEventLoop.FrameE4TestFNS_4TaskIvEES6_iEJPS9_St17reference_wrapperIS5_EiEEEPNS_6detail7PromiseIvEET_DpT0_ENKUlSD_SL_SN_E_clISE_JSG_iEEESB_SD_SL_SN_.Frame*)’:
/var/tmp/portage/dev-cpp/corral-1.0_pre20250424/work/corral-f1fc7ab37f9b0f4a8d4d611d15f92f1e89bebd27/test/../corral/Nursery.h:795:43:
internal compiler error: in gimple_add_tmp_var, at gimplify.cc:802
  795 |                         co_await (obj->*c)(std::move(a)...);
      |                                  ~~~~~~~~~^~~~~~~~~~~~~~~~~
0x5612b3cd91d2 gimple_add_tmp_var(tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:802
0x5612b4d32277 gimplify_target_expr
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:7493
0x5612b4d32277 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:18289
0x5612b4d3180a gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:18614
0x5612b4d3163f gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:18013
0x5612b4d3180a gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:18614
0x5612b4d3163f gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:18013
0x5612b4d4ab60 gimplify_modify_expr
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:6503
0x5612b4d30a12 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:17892
0x5612b4d30419 gimplify_stmt(tree_node**, gimple**)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:7586
0x5612b4e3e0f1 gimplify_cond_expr
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:4888
0x5612b4d31748 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:17846
0x5612b4d30440 gimplify_stmt(tree_node**, gimple**)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:7586
0x5612b4e3e567 gimplify_cond_expr
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:4769
0x5612b4d31748 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:17846
0x5612b4f4f784 gimplify_to_rvalue
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/cp/cp-gimplify.cc:555
0x5612b4f4f784 cp_gimplify_expr(tree_node**, gimple**, gimple**)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/cp/cp-gimplify.cc:793
0x5612b4d306f4 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:17798
0x5612b4d4ab60 gimplify_modify_expr
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:6503
0x5612b4d30a12 gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int)
       
/usr/src/debug/sys-devel/gcc-14.2.1_p20241221/gcc-14-20241221/gcc/gimplify.cc:17892
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
```

I can, however, reproduce this ICE with 15 and trunk (looked the same w/
preprocessed source user gave):
```
$ g++-15 z.ii -std=c++20
z.ii:9:26: warning: literal operator suffixes not preceded by ‘_’ are reserved
for future standardization [-Wliteral-suffix]
    9 | template < char... > int operator""ms();
      |                          ^~~~~~~~

in pp_string, at pretty-print.cc:2655
0x55cde548432d internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic-global-context.cc:517
0x55cde54844d0 fancy_abort(char const*, int, char const*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic.cc:1749
0x55cde394e5bf pp_string(pretty_printer*, char const*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:2655
0x55cde394e55c pp_string(pretty_printer*, char const*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:1341
0x55cde5f04872 format_phase_2
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:2035
0x55cde5f04872 pretty_printer::format(text_info&)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:1711
0x55cde3a4789c pp_format(pretty_printer*, text_info*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.h:594
0x55cde3a4789c pp_format_verbatim(pretty_printer*, text_info*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:2339
0x55cde3a47444 pp_verbatim(pretty_printer*, char const*, ...)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/pretty-print.cc:2618
0x55cde3a42b16 print_instantiation_full_context
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/cp/error.cc:3868
0x55cde3a42b16 maybe_print_instantiation_context
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/cp/error.cc:4086
0x55cde3a42b16 maybe_print_instantiation_context
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/cp/error.cc:4080
0x55cde5f835be cp_diagnostic_text_starter
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/cp/error.cc:3699
0x55cde5f052f4
diagnostic_text_output_format::on_report_diagnostic(diagnostic_info const&,
diagnostic_t)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic-format-text.cc:209
0x55cde5506930 diagnostic_context::report_diagnostic(diagnostic_info*)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic.cc:1510
0x55cde5506531 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic.cc:1641
0x55cde548432d internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/diagnostic-global-context.cc:517
0x55cde4bf59e3 crash_signal
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/gcc/toplev.cc:322
0x55cde5522e89 splay_tree_splay
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/libiberty/splay-tree.c:151
0x55cde5522e89 splay_tree_lookup
       
/usr/src/debug/sys-devel/gcc-15.1.1_p20250503/gcc-15-20250503/libiberty/splay-tree.c:467
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

Reply via email to