public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
@ 2021-09-22 17:13 asolokha at gmx dot com
2021-09-22 17:58 ` [Bug c++/102454] " pinskia at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2021-09-22 17:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Bug ID: 102454
Summary: [12 Regression] ICE in gimplify_var_or_parm_decl, at
gimplify.c:2958
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
g++-12.0.0-alpha20210919 snapshot (g:32731fa5b0abf092029b8e2be64319b978bda514)
ICEs when compiling the following testcase, reduced from
gcc/testsuite/g++.dg/coroutines/torture/co-yield-04-complex-local-state.C, w/
-fcoroutines -fno-exceptions:
#include <coroutine>
#include <string>
template <typename T>
struct looper {
struct promise_type {
auto get_return_object () { return handle_type::from_promise (*this); }
auto initial_suspend () { return suspend_always_prt {}; }
auto final_suspend () noexcept { return suspend_always_prt {}; }
void return_value (T);
void unhandled_exception ();
};
using handle_type = std::coroutine_handle<promise_type>;
looper (handle_type);
struct suspend_always_prt {
bool await_ready () noexcept;
void await_suspend (handle_type) noexcept;
void await_resume () noexcept;
};
};
template <typename T>
looper<T>
with_ctorable_state (T)
{
co_return T ();
}
auto
foo ()
{
return with_ctorable_state<std::string>;
}
% g++-12.0.0 -fcoroutines -fno-exceptions -c n7pshqai.C
n7pshqai.C: In function 'looper<T> with_ctorable_state(T) [with T =
std::__cxx11::basic_string<char>]':
n7pshqai.C:27:1: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.c:2958
27 | with_ctorable_state (T)
| ^~~~~~~~~~~~~~~~~~~
0x7984d0 gimplify_var_or_parm_decl
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:2958
0xe96100 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:15029
0xeaefd3 gimplify_modify_expr
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:5960
0xe960ed gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:14568
0xeb0f2b gimplify_cleanup_point_expr
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:7006
0xe964f1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:14961
0xe999d6 gimplify_stmt(tree_node**, gimple**)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:7006
0xe9746b gimplify_statement_list
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:1997
0xe9746b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:15013
0xe999d6 gimplify_stmt(tree_node**, gimple**)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:7006
0xe9a28f gimplify_bind_expr
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:1426
0xe967b4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:14769
0xeb04d6 gimplify_stmt(tree_node**, gimple**)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:7006
0xeb04d6 gimplify_body(tree_node*, bool)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:15814
0xeb094d gimplify_function_tree(tree_node*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/gimplify.c:15968
0xcce107 cgraph_node::analyze()
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/cgraphunit.c:670
0xcd0d57 analyze_functions
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/cgraphunit.c:1234
0xcd1a3d symbol_table::finalize_compilation_unit()
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210919/work/gcc-12-20210919/gcc/cgraphunit.c:2508
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
@ 2021-09-22 17:58 ` pinskia at gcc dot gnu.org
2021-09-27 13:36 ` [Bug c++/102454] " marxin at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-22 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
2021-09-22 17:58 ` [Bug c++/102454] " pinskia at gcc dot gnu.org
@ 2021-09-27 13:36 ` marxin at gcc dot gnu.org
2021-09-27 18:40 ` iains at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-27 13:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |iains at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-09-27
Summary|[12 Regression] ICE in |ICE in
|gimplify_var_or_parm_decl, |gimplify_var_or_parm_decl,
|at gimplify.c:2958 |at gimplify.c:2958
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed. Started with the revision the coroutines were added.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
2021-09-22 17:58 ` [Bug c++/102454] " pinskia at gcc dot gnu.org
2021-09-27 13:36 ` [Bug c++/102454] " marxin at gcc dot gnu.org
@ 2021-09-27 18:40 ` iains at gcc dot gnu.org
2021-09-27 19:39 ` iains at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-09-27 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
this is caused by an omitted "flag_exceptions" on the update to a frame
variable DTOR, that it "started with the rev coroutines was added" is somewhat
surprising - since the guard vars were only added with r11-7527-gfe55086547c.
patch under test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (2 preceding siblings ...)
2021-09-27 18:40 ` iains at gcc dot gnu.org
@ 2021-09-27 19:39 ` iains at gcc dot gnu.org
2021-09-28 18:54 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-09-27 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580328.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (3 preceding siblings ...)
2021-09-27 19:39 ` iains at gcc dot gnu.org
@ 2021-09-28 18:54 ` cvs-commit at gcc dot gnu.org
2021-10-03 19:22 ` [Bug c++/102454] coroutines: " cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-28 18:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:
https://gcc.gnu.org/g:fae627162d5f8cfb273b10349883eeb74baaa43f
commit r12-3932-gfae627162d5f8cfb273b10349883eeb74baaa43f
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Mon Sep 27 20:21:40 2021 +0100
coroutines: Only set parm copy guard vars if we have exceptions [PR
102454].
For coroutines, we make copies of the original function arguments into
the coroutine frame. Normally, these are destroyed on the proper exit
from the coroutine when the frame is destroyed.
However, if an exception is thrown before the first suspend point is
reached, the cleanup has to happen in the ramp function. These cleanups
are guarded such that they are only applied to any param copies actually
made.
The ICE is caused by an attempt to set the guard variable when there are
no exceptions enabled (the guard var is not created in this case).
Fixed by checking for flag_exceptions in this case too.
While touching this code paths, also clean up the synthetic names used
when a function parm is unnamed.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/102454
gcc/cp/ChangeLog:
* coroutines.cc (analyze_fn_parms): Clean up synthetic names for
unnamed function params.
(morph_fn_to_coro): Do not try to set a guard variable for param
DTORs in the ramp, unless we have exceptions active.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr102454.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] coroutines: ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (4 preceding siblings ...)
2021-09-28 18:54 ` cvs-commit at gcc dot gnu.org
@ 2021-10-03 19:22 ` cvs-commit at gcc dot gnu.org
2021-11-25 17:51 ` asolokha at gmx dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-03 19:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:
https://gcc.gnu.org/g:a1ef1020c424d8f3ca1486ce12408819f4746fd6
commit r11-9063-ga1ef1020c424d8f3ca1486ce12408819f4746fd6
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Mon Sep 27 20:21:40 2021 +0100
coroutines: Only set parm copy guard vars if we have exceptions [PR
102454].
For coroutines, we make copies of the original function arguments into
the coroutine frame. Normally, these are destroyed on the proper exit
from the coroutine when the frame is destroyed.
However, if an exception is thrown before the first suspend point is
reached, the cleanup has to happen in the ramp function. These cleanups
are guarded such that they are only applied to any param copies actually
made.
The ICE is caused by an attempt to set the guard variable when there are
no exceptions enabled (the guard var is not created in this case).
Fixed by checking for flag_exceptions in this case too.
While touching this code paths, also clean up the synthetic names used
when a function parm is unnamed.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/102454
gcc/cp/ChangeLog:
* coroutines.cc (analyze_fn_parms): Clean up synthetic names for
unnamed function params.
(morph_fn_to_coro): Do not try to set a guard variable for param
DTORs in the ramp, unless we have exceptions active.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr102454.C: New test.
(cherry picked from commit fae627162d5f8cfb273b10349883eeb74baaa43f)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] coroutines: ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (5 preceding siblings ...)
2021-10-03 19:22 ` [Bug c++/102454] coroutines: " cvs-commit at gcc dot gnu.org
@ 2021-11-25 17:51 ` asolokha at gmx dot com
2021-11-25 19:01 ` iains at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2021-11-25 17:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
--- Comment #6 from Arseny Solokha <asolokha at gmx dot com> ---
Should this PR be closed now?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] coroutines: ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (6 preceding siblings ...)
2021-11-25 17:51 ` asolokha at gmx dot com
@ 2021-11-25 19:01 ` iains at gcc dot gnu.org
2022-05-06 8:31 ` jakub at gcc dot gnu.org
2023-05-08 12:22 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-11-25 19:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
I was leaving it to check if we needed to back port to 10.x as well.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] coroutines: ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (7 preceding siblings ...)
2021-11-25 19:01 ` iains at gcc dot gnu.org
@ 2022-05-06 8:31 ` jakub at gcc dot gnu.org
2023-05-08 12:22 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |12.2
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/102454] coroutines: ICE in gimplify_var_or_parm_decl, at gimplify.c:2958
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
` (8 preceding siblings ...)
2022-05-06 8:31 ` jakub at gcc dot gnu.org
@ 2023-05-08 12:22 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102454
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.3 |12.4
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-05-08 12:22 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 17:13 [Bug c++/102454] New: [12 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2958 asolokha at gmx dot com
2021-09-22 17:58 ` [Bug c++/102454] " pinskia at gcc dot gnu.org
2021-09-27 13:36 ` [Bug c++/102454] " marxin at gcc dot gnu.org
2021-09-27 18:40 ` iains at gcc dot gnu.org
2021-09-27 19:39 ` iains at gcc dot gnu.org
2021-09-28 18:54 ` cvs-commit at gcc dot gnu.org
2021-10-03 19:22 ` [Bug c++/102454] coroutines: " cvs-commit at gcc dot gnu.org
2021-11-25 17:51 ` asolokha at gmx dot com
2021-11-25 19:01 ` iains at gcc dot gnu.org
2022-05-06 8:31 ` jakub at gcc dot gnu.org
2023-05-08 12:22 ` rguenth 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).