public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object
@ 2021-05-15 12:28 nilsgladitz at gmail dot com
2021-05-15 12:51 ` [Bug c++/100611] " nilsgladitz at gmail dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: nilsgladitz at gmail dot com @ 2021-05-15 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
Bug ID: 100611
Summary: coroutines: destructor called too many times for
coroutine lambda stored object
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nilsgladitz at gmail dot com
Target Milestone: ---
Created attachment 50816
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50816&action=edit
test case
Given the attached test case compiled and run with e.g.
g++ test.cpp -std=c++20 -fcoroutines && ./a.out
produces the output:
Foo(23) 0x55c938eb5ed4
Foo(const& 23) 0x55c938eb5ee4
~Foo(23) 0x55c938eb5ee0
~Foo(23) 0x55c938eb5ee4
~Foo(23) 0x55c938eb5ed4
Indicating that "Foo" is constructed more often than it gets destructed.
This may be a variation of or related to bug 99576 which my test case is based
on.
Bug 99576 seems to be observable in 10.2 while this new issue seems to be
observable in 10.3 and 11.1.
Bisecting the gcc-10 release branch the dividing commit seems to be:
commit f43a1b1d1718969423337190ddbbbc9037c67783
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Sun Jul 19 18:39:21 2020 +0100
coroutines: Correct frame capture of compiler temps [PR95591+4].
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
@ 2021-05-15 12:51 ` nilsgladitz at gmail dot com
2021-05-23 9:01 ` jehelset at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: nilsgladitz at gmail dot com @ 2021-05-15 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
--- Comment #1 from Nils Gladitz <nilsgladitz at gmail dot com> ---
(In reply to Nils Gladitz from comment #0)
> Indicating that "Foo" is constructed more often than it gets destructed.
Sorry that of course was supposed to read:
Indicating that "Foo" is destructed more often than it gets constructed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
2021-05-15 12:51 ` [Bug c++/100611] " nilsgladitz at gmail dot com
@ 2021-05-23 9:01 ` jehelset at gmail dot com
2021-06-10 14:15 ` davidledger at live dot com.au
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jehelset at gmail dot com @ 2021-05-23 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
John Eivind Helset <jehelset at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jehelset at gmail dot com
--- Comment #2 from John Eivind Helset <jehelset at gmail dot com> ---
Maybe related: https://godbolt.org/z/vsc8MYTcn
In my case it seemed like co_awaiting expressions that involved
compiler-generator constructors binding references to pr-values was
problematic, or something along these lines.
Was a problem on 11.1. Couldn't reproduce on 10.2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
2021-05-15 12:51 ` [Bug c++/100611] " nilsgladitz at gmail dot com
2021-05-23 9:01 ` jehelset at gmail dot com
@ 2021-06-10 14:15 ` davidledger at live dot com.au
2021-08-09 0:41 ` davidledger at live dot com.au
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: davidledger at live dot com.au @ 2021-06-10 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
David Ledger <davidledger at live dot com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |davidledger at live dot com.au
--- Comment #3 from David Ledger <davidledger at live dot com.au> ---
Ah, yeah this seems to be the same:
https://godbolt.org/z/8r8oGG4z5
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (2 preceding siblings ...)
2021-06-10 14:15 ` davidledger at live dot com.au
@ 2021-08-09 0:41 ` davidledger at live dot com.au
2021-10-01 20:14 ` iains at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: davidledger at live dot com.au @ 2021-08-09 0:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
--- Comment #4 from David Ledger <davidledger at live dot com.au> ---
It still seems like a bug though.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (3 preceding siblings ...)
2021-08-09 0:41 ` davidledger at live dot com.au
@ 2021-10-01 20:14 ` iains at gcc dot gnu.org
2021-10-01 20:37 ` iains at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-01 20:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-10-01
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (4 preceding siblings ...)
2021-10-01 20:14 ` iains at gcc dot gnu.org
@ 2021-10-01 20:37 ` iains at gcc dot gnu.org
2022-12-04 10:41 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-01 20:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |victor.burckel at gmail dot com
--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
*** Bug 101243 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (5 preceding siblings ...)
2021-10-01 20:37 ` iains at gcc dot gnu.org
@ 2022-12-04 10:41 ` cvs-commit at gcc dot gnu.org
2024-04-04 19:25 ` vipcxj at 126 dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-04 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
--- Comment #6 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:58a7b1e354530d8dfe7d8fb859c8b8b5a9140f1f
commit r13-4479-g58a7b1e354530d8dfe7d8fb859c8b8b5a9140f1f
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Wed Nov 30 17:05:56 2022 +0000
coroutines: Do not promote temporaries that will be elided.
We usually need to 'promote' (i.e. save to the coroutine frame) any
temporary
variable that is in a target expression that must persist across an await
expression. However, if the TE is just used as a direct initializer for
another object it will be elided - and we should not promote it since that
would lead to a DTOR call for something that is never constructed.
Since we now have a mechanism to tell if TEs will be elided, use that.
Although the PRs referenced initially appear to be different issues, they
all
stem from this.
Co-Authored-By: Adrian Perl <adrian.perl@web.de>
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/100611
PR c++/101367
PR c++/101976
PR c++/99576
gcc/cp/ChangeLog:
* coroutines.cc (find_interesting_subtree): Do not promote
temporaries
that are only used as direct initializers for some other object.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/pr100611.C: New test.
* g++.dg/coroutines/pr101367.C: New test.
* g++.dg/coroutines/pr101976.C: New test.
* g++.dg/coroutines/pr99576_1.C: New test.
* g++.dg/coroutines/pr99576_2.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (6 preceding siblings ...)
2022-12-04 10:41 ` cvs-commit at gcc dot gnu.org
@ 2024-04-04 19:25 ` vipcxj at 126 dot com
2024-04-04 19:39 ` avi at scylladb dot com
2024-04-04 19:40 ` avi at scylladb dot com
9 siblings, 0 replies; 11+ messages in thread
From: vipcxj at 126 dot com @ 2024-04-04 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
vipcxj at 126 dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vipcxj at 126 dot com
--- Comment #7 from vipcxj at 126 dot com ---
Today I got an account here to report a bug, and realized that the bug was
reported 3 years ago. The version of gcc I'm using is 12.3.0, and it looks like
this bug hasn't been fixed in 3 years~
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (7 preceding siblings ...)
2024-04-04 19:25 ` vipcxj at 126 dot com
@ 2024-04-04 19:39 ` avi at scylladb dot com
2024-04-04 19:40 ` avi at scylladb dot com
9 siblings, 0 replies; 11+ messages in thread
From: avi at scylladb dot com @ 2024-04-04 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
--- Comment #8 from Avi Kivity <avi at scylladb dot com> ---
Congratulations on getting the account!
The bug is fixed though.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/100611] coroutines: destructor called too many times for coroutine lambda stored object
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
` (8 preceding siblings ...)
2024-04-04 19:39 ` avi at scylladb dot com
@ 2024-04-04 19:40 ` avi at scylladb dot com
9 siblings, 0 replies; 11+ messages in thread
From: avi at scylladb dot com @ 2024-04-04 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100611
--- Comment #9 from Avi Kivity <avi at scylladb dot com> ---
At least, on 13.2.1. Maybe a backport is required.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-04-04 19:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 12:28 [Bug c++/100611] New: coroutines: destructor called too many times for coroutine lambda stored object nilsgladitz at gmail dot com
2021-05-15 12:51 ` [Bug c++/100611] " nilsgladitz at gmail dot com
2021-05-23 9:01 ` jehelset at gmail dot com
2021-06-10 14:15 ` davidledger at live dot com.au
2021-08-09 0:41 ` davidledger at live dot com.au
2021-10-01 20:14 ` iains at gcc dot gnu.org
2021-10-01 20:37 ` iains at gcc dot gnu.org
2022-12-04 10:41 ` cvs-commit at gcc dot gnu.org
2024-04-04 19:25 ` vipcxj at 126 dot com
2024-04-04 19:39 ` avi at scylladb dot com
2024-04-04 19:40 ` avi at scylladb 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).