public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98432] New: [coroutine] leaked frame created using await_transform
@ 2020-12-23 21:13 hering.t at seznam dot cz
  2020-12-23 21:19 ` [Bug c++/98432] " hering.t at seznam dot cz
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hering.t at seznam dot cz @ 2020-12-23 21:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

            Bug ID: 98432
           Summary: [coroutine] leaked frame created using await_transform
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hering.t at seznam dot cz
  Target Milestone: ---

I think I encounter a memory leak caused by implementation when using
await_transform to turn arbitrary type into awaitable. I track the number of
(internally) allocated coroutine frames and expect to see zero as the final
figure, one remains unfreed however.

cmd line: g++.exe gcc_coro_leak.cpp -std=c++20 -O3 -Wall -Wextra -fcoroutines

Platforms tested: avr, x86

Compilation output: 
returned: 0

Execution output:
allocating frame, total count:
1
allocating frame, total count:
2
hello coro-world
deleting frame, remaining count:
1

Program returned: 0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
@ 2020-12-23 21:19 ` hering.t at seznam dot cz
  2021-02-28  1:45 ` iains at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hering.t at seznam dot cz @ 2020-12-23 21:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #1 from Tomáš Hering <hering.t at seznam dot cz> ---
Created attachment 49839
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49839&action=edit
preprocessed file that triggers the bug

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
  2020-12-23 21:19 ` [Bug c++/98432] " hering.t at seznam dot cz
@ 2021-02-28  1:45 ` iains at gcc dot gnu.org
  2021-03-01 16:22 ` hering.t at seznam dot cz
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-02-28  1:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Tomáš Hering from comment #1)
> Created attachment 49839 [details]
> preprocessed file that triggers the bug

please could you attach the un-preprocessed source?
I cannot reproduce this with the preprocessed source (I don't have a mingw pc
setup available).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
  2020-12-23 21:19 ` [Bug c++/98432] " hering.t at seznam dot cz
  2021-02-28  1:45 ` iains at gcc dot gnu.org
@ 2021-03-01 16:22 ` hering.t at seznam dot cz
  2021-03-01 16:57 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hering.t at seznam dot cz @ 2021-03-01 16:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

Tomáš Hering <hering.t at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #49839|0                           |1
        is obsolete|                            |

--- Comment #3 from Tomáš Hering <hering.t at seznam dot cz> ---
Created attachment 50276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50276&action=edit
unprocessed source

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (2 preceding siblings ...)
  2021-03-01 16:22 ` hering.t at seznam dot cz
@ 2021-03-01 16:57 ` iains at gcc dot gnu.org
  2021-03-01 17:45 ` hering.t at seznam dot cz
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-01 16:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Tomáš Hering from comment #3)
> Created attachment 50276 [details]
> unprocessed source

thanks!

but ... (on x86_64-linux-gnu and x86_64-darwin16):

$ gcc-10-2/bin/g++  -std=c++20 -fcoroutines pr98432.C  -o t -O3 -Wall -Wextra
$ ./t
allocated frames
1
allocated frames
2
allocated frames
3
allocated frames:
2
allocated frames:
1
hello coro-world
allocated frames:
0
===

same on 10.x and master. [ I will try on some older platforms, and on a 32b
host too, later ].

So I'm still a bit stuck - given that coroutines is pretty much a Front End
code base, it seems odd that there would be some platform dependence here (I
guess there could be a an allocation/deallocation bug).

Maybe we could try to find some difference in the initial gimple 
[-fdump-tree-gimple].

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (3 preceding siblings ...)
  2021-03-01 16:57 ` iains at gcc dot gnu.org
@ 2021-03-01 17:45 ` hering.t at seznam dot cz
  2021-03-01 21:42 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hering.t at seznam dot cz @ 2021-03-01 17:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

Tomáš Hering <hering.t at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #50276|0                           |1
        is obsolete|                            |

--- Comment #5 from Tomáš Hering <hering.t at seznam dot cz> ---
Created attachment 50278
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50278&action=edit
unprocessed original source

Oops, seems I uploaded a slightly different code. I apologize. It's strange you
can't reproduce the issue, though. Please see the demo with the original code
on godbolt (https://godbolt.org/z/Gao919) which is in accordance with my local
output. Please note that the behavior now seems correct when setting the trunk
version of gcc there. Perhaps it has been fixed in some recent commit.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (4 preceding siblings ...)
  2021-03-01 17:45 ` hering.t at seznam dot cz
@ 2021-03-01 21:42 ` iains at gcc dot gnu.org
  2021-03-02  8:32 ` hering.t at seznam dot cz
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-01 21:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Tomáš Hering from comment #5)
> Created attachment 50278 [details]
> unprocessed original source
> 
> Oops, seems I uploaded a slightly different code. I apologize. It's strange
> you can't reproduce the issue, though. Please see the demo with the original
> code on godbolt (https://godbolt.org/z/Gao919) which is in accordance with
> my local output. Please note that the behavior now seems correct when
> setting the trunk version of gcc there. Perhaps it has been fixed in some
> recent commit.

>From my tests, it is fixed on 10.x and master - (In reply to Tomáš Hering from
comment #5)
> Created attachment 50278 [details]
> unprocessed original source
> 
> Oops, seems I uploaded a slightly different code. I apologize. It's strange
> you can't reproduce the issue, though. Please see the demo with the original
> code on godbolt (https://godbolt.org/z/Gao919) which is in accordance with
> my local output. Please note that the behavior now seems correct when
> setting the trunk version of gcc there. Perhaps it has been fixed in some
> recent commit.

So, even with the original code copied from Compiler Explorer, from my tests,
this is fixed on 10.x and master, therefore I think we can close it here
(unless you want to make a build of the 10.x branch on your platform to
double-check).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (5 preceding siblings ...)
  2021-03-01 21:42 ` iains at gcc dot gnu.org
@ 2021-03-02  8:32 ` hering.t at seznam dot cz
  2021-03-02  9:27 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hering.t at seznam dot cz @ 2021-03-02  8:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #7 from Tomáš Hering <hering.t at seznam dot cz> ---
I'm a bit lost, which github branch corresponds to 10.x that you mention,
please?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (6 preceding siblings ...)
  2021-03-02  8:32 ` hering.t at seznam dot cz
@ 2021-03-02  9:27 ` iains at gcc dot gnu.org
  2021-03-02  9:29 ` iains at gcc dot gnu.org
  2021-10-01 18:33 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-02  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #8 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Tomáš Hering from comment #7)
> I'm a bit lost, which github branch corresponds to 10.x that you mention,
> please?

gcc.gnu.org/git/gcc

branch : releases/gcc-10

(currently 10.2.1 - which will become 10.3 at the next release)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (7 preceding siblings ...)
  2021-03-02  9:27 ` iains at gcc dot gnu.org
@ 2021-03-02  9:29 ` iains at gcc dot gnu.org
  2021-10-01 18:33 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-02  9:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #8)
> (In reply to Tomáš Hering from comment #7)
> > I'm a bit lost, which github branch corresponds to 10.x that you mention,
> > please?
> 
> gcc.gnu.org/git/gcc
> 
> branch : releases/gcc-10
> 
> (currently 10.2.1 - which will become 10.3 at the next release)

https://github.com/gcc-mirror/gcc/tree/releases/gcc-10

(if you're using that)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/98432] [coroutine] leaked frame created using await_transform
  2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
                   ` (8 preceding siblings ...)
  2021-03-02  9:29 ` iains at gcc dot gnu.org
@ 2021-10-01 18:33 ` iains at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: iains at gcc dot gnu.org @ 2021-10-01 18:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98432

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #10 from Iain Sandoe <iains at gcc dot gnu.org> ---
works on all open branches with coroutines support.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-10-01 18:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 21:13 [Bug c++/98432] New: [coroutine] leaked frame created using await_transform hering.t at seznam dot cz
2020-12-23 21:19 ` [Bug c++/98432] " hering.t at seznam dot cz
2021-02-28  1:45 ` iains at gcc dot gnu.org
2021-03-01 16:22 ` hering.t at seznam dot cz
2021-03-01 16:57 ` iains at gcc dot gnu.org
2021-03-01 17:45 ` hering.t at seznam dot cz
2021-03-01 21:42 ` iains at gcc dot gnu.org
2021-03-02  8:32 ` hering.t at seznam dot cz
2021-03-02  9:27 ` iains at gcc dot gnu.org
2021-03-02  9:29 ` iains at gcc dot gnu.org
2021-10-01 18:33 ` 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).