public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
@ 2022-03-30 5:54 jehelset at gmail dot com
2022-03-30 5:59 ` [Bug c++/105104] " jehelset at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jehelset at gmail dot com @ 2022-03-30 5:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
Bug ID: 105104
Summary: [coroutines] ICE during GIMPLE pass:
coro-early-expand-ifns
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jehelset at gmail dot com
Target Milestone: ---
Created attachment 52716
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52716&action=edit
Output from "-fdump-tree-coro-early-expand-ifns=stdout"
Compiler segfaults on `if (EDGE_COUNT (pred->succs) <= EDGE_COUNT
(succ->preds))`, as `succ` is null.
Backtrace:
#0 0x000000000107a2ae in find_edge (pred=0x7fffc626f068, succ=0x0) at
../../gcc/cfganal.cc:523
#1 0x0000000001864cc7 in convert_single_case_switch (swtch=0x7fffc625d2d0,
gsi=...) at ../../gcc/tree-cfgcleanup.cc:118
#2 0x0000000001864d9e in cleanup_control_expr_graph (bb=0x7fffc626f068,
gsi=...) at ../../gcc/tree-cfgcleanup.cc:145
#3 0x00000000018652be in cleanup_control_flow_bb (bb=0x7fffc626f068) at
../../gcc/tree-cfgcleanup.cc:274
#4 0x000000000186712f in cleanup_control_flow_pre () at
../../gcc/tree-cfgcleanup.cc:908
#5 0x00000000018678f2 in cleanup_tree_cfg_noloop (ssa_update_flags=0) at
../../gcc/tree-cfgcleanup.cc:1073
#6 0x0000000001867bbb in cleanup_tree_cfg (ssa_update_flags=0) at
../../gcc/tree-cfgcleanup.cc:1183
#7 0x00000000016893c6 in execute_function_todo (fn=0x7fffcf0580b8, data=0x60)
at ../../gcc/passes.cc:2051
#8 0x00000000016881d9 in do_per_function (callback=0x1689361
<execute_function_todo(function*, void*)>, data=0x60) at
../../gcc/passes.cc:1688
#9 0x000000000168972e in execute_todo (flags=96) at ../../gcc/passes.cc:2139
#10 0x000000000168a838 in execute_one_pass (pass=0x408fb20) at
../../gcc/passes.cc:2675
#11 0x000000000168aa9b in execute_pass_list_1 (pass=0x408fb20) at
../../gcc/passes.cc:2738
#12 0x000000000168ab25 in execute_pass_list (fn=0x7fffcf0580b8, pass=0x408f6a0)
at ../../gcc/passes.cc:2749
#13 0x00000000010f6cbf in cgraph_node::analyze (this=0x7fffcf07d880) at
../../gcc/cgraphunit.cc:685
#14 0x00000000010f8daa in analyze_functions (first_time=true) at
../../gcc/cgraphunit.cc:1240
#15 0x00000000010fc094 in symbol_table::finalize_compilation_unit
(this=0x7ffff70c6000) at ../../gcc/cgraphunit.cc:2500
#16 0x00000000017eb979 in compile_file () at ../../gcc/toplev.cc:479
#17 0x00000000017eea61 in do_compile (no_backend=false) at
../../gcc/toplev.cc:2168
#18 0x00000000017eee49 in toplev::main (this=0x7fffffffdf62, argc=33,
argv=0x7fffffffe098) at ../../gcc/toplev.cc:2320
#19 0x0000000002fd18b1 in main (argc=33, argv=0x7fffffffe098) at
../../gcc/main.cc:39
Dump from tree-coro-early-expand-ifns put in attachment, because of
template-spew.
Compiled with e3d2b0d040e9baf6c0548b865ed5244dec464cc1.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
@ 2022-03-30 5:59 ` jehelset at gmail dot com
2022-03-30 6:08 ` jehelset at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jehelset at gmail dot com @ 2022-03-30 5:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
--- Comment #1 from John Eivind Helset <jehelset at gmail dot com> ---
Indices of `bb` and `case_bb` in `convert_single_case_switch` are:
(gdb) p bb->index
$18 = 154
(gdb) p case_bb->index
$19 = 157
If that helps.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
2022-03-30 5:59 ` [Bug c++/105104] " jehelset at gmail dot com
@ 2022-03-30 6:08 ` jehelset at gmail dot com
2022-03-30 7:09 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jehelset at gmail dot com @ 2022-03-30 6:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
--- Comment #2 from John Eivind Helset <jehelset at gmail dot com> ---
I'll try to create an MRE eventually...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
2022-03-30 5:59 ` [Bug c++/105104] " jehelset at gmail dot com
2022-03-30 6:08 ` jehelset at gmail dot com
@ 2022-03-30 7:09 ` rguenth at gcc dot gnu.org
2022-03-31 21:25 ` jehelset at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-30 7:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-03-30
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Please provide preprocessed source of a testcase.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
` (2 preceding siblings ...)
2022-03-30 7:09 ` rguenth at gcc dot gnu.org
@ 2022-03-31 21:25 ` jehelset at gmail dot com
2022-03-31 23:20 ` jehelset at gmail dot com
2022-04-18 18:56 ` iains at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jehelset at gmail dot com @ 2022-03-31 21:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
--- Comment #4 from John Eivind Helset <jehelset at gmail dot com> ---
It seems a non-void return-type from await-resume of a final awaitable,
combined with at least -O1 causes a segfault: https://godbolt.org/z/rzq8dM7Pr
Not sure if it's the same as the one I initially encountered yet.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
` (3 preceding siblings ...)
2022-03-31 21:25 ` jehelset at gmail dot com
@ 2022-03-31 23:20 ` jehelset at gmail dot com
2022-04-18 18:56 ` iains at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jehelset at gmail dot com @ 2022-03-31 23:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
--- Comment #5 from John Eivind Helset <jehelset at gmail dot com> ---
Created attachment 52729
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52729&action=edit
Patch with testcase.
Tried adding a testcase to the g++.dg/coroutines testsuite. Used dg-ice, but it
seems to complain about excess errors anyways:
FAIL: g++.dg/coroutines/pr105104.C (test for excess errors)
Excess errors:
during GIMPLE pass: coro-early-expand-ifns
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/105104] [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
` (4 preceding siblings ...)
2022-03-31 23:20 ` jehelset at gmail dot com
@ 2022-04-18 18:56 ` iains at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2022-04-18 18:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105104
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2022-03-30 00:00:00 |2022-4-18
CC| |iains at gcc dot gnu.org,
| |jakub at gcc dot gnu.org
Status|WAITING |NEW
Keywords| |ice-on-valid-code
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
Initial analysis - perhaps some issue with constexpr processing:
When we have a void await_return() in the final_awaiter class:
final.suspend:
frame_ptr->_Coro_resume_fn = 0B;
{
struct final_awaiter Fs [value-expr: frame_ptr->Fs_1_2];
frame_ptr->_Coro_resume_index = 4;
_15 = &frame_ptr->_Coro_self_handle;
D.9844 = std::__n4861::coroutine_handle<return_object::promise_type>::operator
std::__n4861::coroutine_handle<void> (_15);
return_object::promise_type::final_awaiter::await_suspend (D.9844);
D.9768 = .CO_YIELD (4, 1, &resume.4, &destroy.4, frame_ptr);
retval.2 = D.9768;
switch (retval.2) <default: <D.9771>, case 0: <D.9769>, case 1: <D.9770>>
<D.9769>:
.CO_SUSPN (&actor.suspend.ret);
<D.9770>:
goto resume.4;
<D.9771>:
goto destroy.4;
destroy.4:
goto coro.delete.promise;
resume.4:
return_object::promise_type::final_awaiter::await_resume ();
}
when the await_resume() function is made to return an int.
final.suspend:
frame_ptr->_Coro_resume_fn = 0B;
{
<snip>
destroy.4:
goto coro.delete.promise;
resume.4:
}
So we have a dangling label at the end of that scope (which then gives rise to
the crash).
* If I remove the 'contexpr' from the await_resume() function, then it all
works as expected.
* AFAICT, the content is correct in "expand_one_await_expression()".
* Altering the coroutines code to cast the result of the await_resume() to void
makes no difference.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-04-18 18:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 5:54 [Bug c++/105104] New: [coroutines] ICE during GIMPLE pass: coro-early-expand-ifns jehelset at gmail dot com
2022-03-30 5:59 ` [Bug c++/105104] " jehelset at gmail dot com
2022-03-30 6:08 ` jehelset at gmail dot com
2022-03-30 7:09 ` rguenth at gcc dot gnu.org
2022-03-31 21:25 ` jehelset at gmail dot com
2022-03-31 23:20 ` jehelset at gmail dot com
2022-04-18 18:56 ` iains at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).