From: Rebecca Ribas <beky.ribas@gmail.com>
To: gcc@gcc.gnu.org
Subject: Confused about coroutine behavior
Date: Fri, 26 Aug 2022 01:55:20 -0400 [thread overview]
Message-ID: <CALoH1AMm4muBJZGYK05oBt57i_aE2gxAfy5AYbByaBnsXh6WOg@mail.gmail.com> (raw)
Hi gcc list,
I'm learning c++ coroutines but I ran into a behavior that I can't make
sense of.
Here is the godbolt link: https://godbolt.org/z/rdPo8ceKP
In some cases, it appears that temporaries are incorrectly freed, the code
shows test1 and test2 that works as expected, but test3 raises a "used
after free" error from address sanitizer that doesn't make sense to me.
I'm aware that there are some potential caveats with passing references to
a coroutine, so I'm possibly missing some subtle detail. But it looks like
it might be a gcc bug since the same doesn't happen with clang.
I tested a few different versions of g++ available on ubuntu and godbolt
but got the same result.
The compilations flags I used were: -ggdb3 -Og -std=c++20 -Wall -Wextra
-Werror -D_GLIBCXX_DEBUG -fsanitize=address
Cheers!
WARNING: multiple messages have this Message-ID
From: Rebecca Ribas <beky.ribas@gmail.com>
To: gcc@gcc.gnu.org
Subject: Confused about coroutine behavior
Date: Fri, 26 Aug 2022 01:55:20 -0400 [thread overview]
Message-ID: <CALoH1AMm4muBJZGYK05oBt57i_aE2gxAfy5AYbByaBnsXh6WOg@mail.gmail.com> (raw)
Message-ID: <20220826055520.wV5Y8fRYfQpwonH0x14eMmeFqu2i7MY8Lpdyxq4kdIw@z> (raw)
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
Hi gcc list,
I'm learning c++ coroutines but I ran into a behavior that I can't make
sense of.
Here is the godbolt link: https://godbolt.org/z/rdPo8ceKP
In some cases, it appears that temporaries are incorrectly freed, the code
shows test1 and test2 that works as expected, but test3 raises a "used
after free" error from address sanitizer that doesn't make sense to me.
I'm aware that there are some potential caveats with passing references to
a coroutine, so I'm possibly missing some subtle detail. But it looks like
it might be a gcc bug since the same doesn't happen with clang.
I tested a few different versions of g++ available on ubuntu and godbolt
but got the same result.
The compilations flags I used were: -ggdb3 -Og -std=c++20 -Wall -Wextra
-Werror -D_GLIBCXX_DEBUG -fsanitize=address
Cheers!
next reply other threads:[~2022-08-26 5:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 5:55 Rebecca Ribas [this message]
2022-08-26 5:55 ` Rebecca Ribas
2022-08-26 9:12 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALoH1AMm4muBJZGYK05oBt57i_aE2gxAfy5AYbByaBnsXh6WOg@mail.gmail.com \
--to=beky.ribas@gmail.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).