public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE.
@ 2021-05-19 10:35 jehelset at gmail dot com
2021-05-22 3:07 ` [Bug c++/100673] " jehelset at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: jehelset at gmail dot com @ 2021-05-19 10:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
Bug ID: 100673
Summary: [coroutines] Non-template, UDT await_suspend
return-type results in ICE.
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 50844
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50844&action=edit
ICE on non-template UDT await_suspend return-type.
A non-template udt return-type from await_suspend will ICE on trunk:
https://godbolt.org/z/Gn7djfrac
#0 build_co_await (loc=674010823, a=0x7ffff163f1c0, suspend_kind=<optimized
out>) at ../../gcc/cp/coroutines.cc:993
993 tree tt = CLASSTYPE_TI_TEMPLATE (susp_return_type);
Relevant code:
else if (TREE_CODE (susp_return_type) == RECORD_TYPE
&& CLASS_TYPE_P (susp_return_type))
{
tree tt = CLASSTYPE_TI_TEMPLATE (susp_return_type);
if (tt == coro_handle_templ)
ok = true;
}
Seems to be checking the validity of the await_suspend call, to produce a
helpful diagnostic. Perhaps the conditional also needs to verify that
CLASSTYPE_TEMPLATE_INFO (coro_handle_templ) is non-NULL, before using
CLASSTYPE_TI_TEMPLATE.
Seemed to be the case on 10.3, 11.1 and on 12.0. 10.2 failed to compile it
without crashing.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
@ 2021-05-22 3:07 ` jehelset at gmail dot com
2021-10-01 20:29 ` iains at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jehelset at gmail dot com @ 2021-05-22 3:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
--- Comment #1 from John Eivind Helset <jehelset at gmail dot com> ---
Created attachment 50854
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50854&action=edit
Add CLASSTYPE_TEMPLATE_INFO guard and test-case.
Tried to guard the the conditional with CLASSTYPE_TEMPLATE_INFO as it seemed
like the common approach in the codebase, to verify that the return-type was a
template. And a testcase.
Remove the guard to observe ICE in the test-case.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
2021-05-22 3:07 ` [Bug c++/100673] " jehelset at gmail dot com
@ 2021-10-01 20:29 ` iains at gcc dot gnu.org
2021-10-01 20:30 ` iains at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-01 20:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-10-1
CC| |iains at gcc dot gnu.org
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
thanks for the patch - queued to apply.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
2021-05-22 3:07 ` [Bug c++/100673] " jehelset at gmail dot com
2021-10-01 20:29 ` iains at gcc dot gnu.org
@ 2021-10-01 20:30 ` iains at gcc dot gnu.org
2021-10-02 18:39 ` iains at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-01 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
` (2 preceding siblings ...)
2021-10-01 20:30 ` iains at gcc dot gnu.org
@ 2021-10-02 18:39 ` iains at gcc dot gnu.org
2021-10-03 19:50 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-02 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
` (3 preceding siblings ...)
2021-10-02 18:39 ` iains at gcc dot gnu.org
@ 2021-10-03 19:50 ` cvs-commit at gcc dot gnu.org
2021-12-21 19:38 ` pinskia at gcc dot gnu.org
2023-05-29 15:03 ` jehelset at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-03 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
--- Comment #3 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:8009c79b64b532d8a0966fe3c6d636369df6e35d
commit r12-4101-g8009c79b64b532d8a0966fe3c6d636369df6e35d
Author: John Eivind Helset <jehelset@gmail.com>
Date: Sat May 22 01:53:22 2021 +0200
coroutines: Fix ICE with an invalid await_suspend type [PR100673].
The reported ICE occurs when an invalid (non-template) type is found
as the return for an await_suspend.
Fixed by amending build_co_await to ensure that await_suspend return-
type is a template-instantiation before checking to see if it is a
valid coroutine handle type.
Signed-off-by: John Eivind Helset <jehelset@gmail.com>
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/100673
gcc/cp/ChangeLog:
* coroutines.cc (build_co_await): Guard against NULL
await_suspend types.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr100673.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
` (4 preceding siblings ...)
2021-10-03 19:50 ` cvs-commit at gcc dot gnu.org
@ 2021-12-21 19:38 ` pinskia at gcc dot gnu.org
2023-05-29 15:03 ` jehelset at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-21 19:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jack.cui2 at foxmail dot com
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103790 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/100673] [coroutines] Non-template, UDT await_suspend return-type results in ICE.
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
` (5 preceding siblings ...)
2021-12-21 19:38 ` pinskia at gcc dot gnu.org
@ 2023-05-29 15:03 ` jehelset at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: jehelset at gmail dot com @ 2023-05-29 15:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100673
John Eivind Helset <jehelset at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from John Eivind Helset <jehelset at gmail dot com> ---
Looks good now!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-05-29 15:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 10:35 [Bug c++/100673] New: [coroutines] Non-template, UDT await_suspend return-type results in ICE jehelset at gmail dot com
2021-05-22 3:07 ` [Bug c++/100673] " jehelset at gmail dot com
2021-10-01 20:29 ` iains at gcc dot gnu.org
2021-10-01 20:30 ` iains at gcc dot gnu.org
2021-10-02 18:39 ` iains at gcc dot gnu.org
2021-10-03 19:50 ` cvs-commit at gcc dot gnu.org
2021-12-21 19:38 ` pinskia at gcc dot gnu.org
2023-05-29 15:03 ` jehelset at gmail dot com
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).