* [Bug c++/116327] ICE in coroutine with parameter preview on lambda with captures.
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
@ 2024-08-10 14:47 ` jehelset at gmail dot com
2024-08-10 15:03 ` jehelset at gmail dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jehelset at gmail dot com @ 2024-08-10 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #1 from John Eivind Helset <jehelset at gmail dot com> ---
Created attachment 58899
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58899&action=edit
Reproducer, compile with --std=c++20
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] ICE in coroutine with parameter preview on lambda with captures.
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
2024-08-10 14:47 ` [Bug c++/116327] " jehelset at gmail dot com
@ 2024-08-10 15:03 ` jehelset at gmail dot com
2024-08-12 13:36 ` [Bug c++/116327] [14/15 Regression] " ppalka at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jehelset at gmail dot com @ 2024-08-10 15:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #2 from John Eivind Helset <jehelset at gmail dot com> ---
had to revert both changes in 066c7893eae to compile my hobby project without
ICE.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures.
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
2024-08-10 14:47 ` [Bug c++/116327] " jehelset at gmail dot com
2024-08-10 15:03 ` jehelset at gmail dot com
@ 2024-08-12 13:36 ` ppalka at gcc dot gnu.org
2024-08-12 14:33 ` ppalka at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-08-12 13:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Target Milestone|--- |14.3
Summary|ICE in coroutine with |[14/15 Regression] ICE in
|parameter preview on lambda |coroutine with parameter
|with captures. |preview on lambda with
| |captures.
Known to work| |14.1.0
Known to fail| |14.2.0, 15.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures.
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (2 preceding siblings ...)
2024-08-12 13:36 ` [Bug c++/116327] [14/15 Regression] " ppalka at gcc dot gnu.org
@ 2024-08-12 14:33 ` ppalka at gcc dot gnu.org
2024-08-13 1:56 ` [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210 jehelset at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-08-12 14:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-08-12
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, the ICE seems to only happen with -O0. Compiling with optimizations
is OK
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (3 preceding siblings ...)
2024-08-12 14:33 ` ppalka at gcc dot gnu.org
@ 2024-08-13 1:56 ` jehelset at gmail dot com
2024-08-13 13:35 ` ppalka at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jehelset at gmail dot com @ 2024-08-13 1:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #4 from John Eivind Helset <jehelset at gmail dot com> ---
if compiling my project with 14.2.1 in release mode (cmake / -O3) i got another
ICE from `internal compiler error: in set_parm_rtl, at cfgexpand.cc:1436`.
0x21a7bea internal_error(char const*, ...)
???:0
0x703e99 fancy_abort(char const*, int, char const*)
???:0
0xbd4dfd expand_function_start(tree_node*)
???:0
i didn't try to debug gcc 14.2.1 when compiling in release, but i checked that
i could compile in release without 066c7893eae on master (2b23a444bcf).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (4 preceding siblings ...)
2024-08-13 1:56 ` [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210 jehelset at gmail dot com
@ 2024-08-13 13:35 ` ppalka at gcc dot gnu.org
2024-08-13 14:51 ` jehelset at gmail dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-08-13 13:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Ah, never mind then. Candidate patch posted for review at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660212.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (5 preceding siblings ...)
2024-08-13 13:35 ` ppalka at gcc dot gnu.org
@ 2024-08-13 14:51 ` jehelset at gmail dot com
2024-08-15 14:20 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jehelset at gmail dot com @ 2024-08-13 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #6 from John Eivind Helset <jehelset at gmail dot com> ---
Works, thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (6 preceding siblings ...)
2024-08-13 14:51 ` jehelset at gmail dot com
@ 2024-08-15 14:20 ` cvs-commit at gcc dot gnu.org
2024-08-15 14:33 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-08-15 14:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:303bed670af962c01b77a4f0c51de97f70e8167e
commit r15-2932-g303bed670af962c01b77a4f0c51de97f70e8167e
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Aug 15 10:20:18 2024 -0400
c++/coroutines: fix passing *this to promise type, again [PR116327]
In r15-2210 we got rid of the unnecessary cast to lvalue reference when
passing *this to the promise type ctor, and as a drive-by change we also
simplified the code to use cp_build_fold_indirect_ref.
But it turns out cp_build_fold_indirect_ref does too much here, namely
it has a shortcut for returning current_class_ref if the operand is
current_class_ptr. The problem with that shortcut is current_class_ref
might have gotten clobbered earlier if it appeared in the function body,
since rewrite_param_uses walks and rewrites in-place all local variable
uses to their corresponding frame copy.
So later cp_build_fold_indirect_ref for *this will instead return the
clobbered current_class_ref i.e. *frame_ptr->this, which doesn't make
sense here since we're in the ramp function and not the actor function
where frame_ptr is in scope.
This patch fixes this by using the build_fold_indirect_ref instead of
cp_build_fold_indirect_ref.
PR c++/116327
PR c++/104981
PR c++/115550
gcc/cp/ChangeLog:
* coroutines.cc (morph_fn_to_coro): Use build_fold_indirect_ref
instead of cp_build_fold_indirect_ref.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr104981-preview-this.C: Improve coverage by
adding a non-static data member use within the coroutine member
function.
* g++.dg/coroutines/pr116327-preview-this.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (7 preceding siblings ...)
2024-08-15 14:20 ` cvs-commit at gcc dot gnu.org
@ 2024-08-15 14:33 ` cvs-commit at gcc dot gnu.org
2024-08-15 14:39 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-08-15 14:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:63c51e09d160a44fdce1199e8efe9d293f773a2c
commit r14-10586-g63c51e09d160a44fdce1199e8efe9d293f773a2c
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Aug 15 10:20:18 2024 -0400
c++/coroutines: fix passing *this to promise type, again [PR116327]
In r15-2210 we got rid of the unnecessary cast to lvalue reference when
passing *this to the promise type ctor, and as a drive-by change we also
simplified the code to use cp_build_fold_indirect_ref.
But it turns out cp_build_fold_indirect_ref does too much here, namely
it has a shortcut for returning current_class_ref if the operand is
current_class_ptr. The problem with that shortcut is current_class_ref
might have gotten clobbered earlier if it appeared in the function body,
since rewrite_param_uses walks and rewrites in-place all local variable
uses to their corresponding frame copy.
So later cp_build_fold_indirect_ref for *this will instead return the
clobbered current_class_ref i.e. *frame_ptr->this, which doesn't make
sense here since we're in the ramp function and not the actor function
where frame_ptr is in scope.
This patch fixes this by using the build_fold_indirect_ref instead of
cp_build_fold_indirect_ref.
PR c++/116327
PR c++/104981
PR c++/115550
gcc/cp/ChangeLog:
* coroutines.cc (morph_fn_to_coro): Use build_fold_indirect_ref
instead of cp_build_fold_indirect_ref.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr104981-preview-this.C: Improve coverage by
adding a non-static data member use within the coroutine member
function.
* g++.dg/coroutines/pr116327-preview-this.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 303bed670af962c01b77a4f0c51de97f70e8167e)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (8 preceding siblings ...)
2024-08-15 14:33 ` cvs-commit at gcc dot gnu.org
@ 2024-08-15 14:39 ` ppalka at gcc dot gnu.org
2024-08-21 19:02 ` pinskia at gcc dot gnu.org
2024-09-19 22:21 ` arsen at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-08-15 14:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.3, thanks for the bug report.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (9 preceding siblings ...)
2024-08-15 14:39 ` ppalka at gcc dot gnu.org
@ 2024-08-21 19:02 ` pinskia at gcc dot gnu.org
2024-09-19 22:21 ` arsen at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-21 19:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |indiosmo at gmail dot com
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 116450 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/116327] [14/15 Regression] ICE in coroutine with parameter preview on lambda with captures since r15-2210
2024-08-10 14:42 [Bug c++/116327] New: ICE in coroutine with parameter preview on lambda with captures jehelset at gmail dot com
` (10 preceding siblings ...)
2024-08-21 19:02 ` pinskia at gcc dot gnu.org
@ 2024-09-19 22:21 ` arsen at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: arsen at gcc dot gnu.org @ 2024-09-19 22:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116327
Arsen Arsenović <arsen at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ivor+gccbugzilla at posteo dot ee
--- Comment #11 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
*** Bug 116633 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 13+ messages in thread