public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105804] New: List-initialized argument in await expression is doubly freed
@ 2022-06-01 15:14 blubban at gmail dot com
  2023-04-16 18:10 ` [Bug c++/105804] coroutines: " blubban at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: blubban at gmail dot com @ 2022-06-01 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105804
           Summary: List-initialized argument in await expression is
                    doubly freed
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blubban at gmail dot com
  Target Milestone: ---

#include <coroutine>
#include <memory>

struct my_params {
        std::unique_ptr<int> ptr; // or any other object with nontrivial dtor
};

static std::suspend_never take_params(my_params params)
{
        return {};
}

struct coro_t {
        struct promise_type {
                coro_t get_return_object() { return {}; }
                std::suspend_never initial_suspend() { return {}; }
                std::suspend_never final_suspend() noexcept { return {}; }
                void unhandled_exception() noexcept {}
        };
};

static coro_t my_coro()
{
        co_await take_params({ std::make_unique<int>(5) });
}

int main()
{
        my_coro();
}


Expected output: Same as /bin/true
Actual: free(): double free detected in tcache 2

https://godbolt.org/z/8f9d3TzYo

Probably same root cause as bug 98056 and/or bug 103871, but since the symptoms
are way different (it's a wrong-code, not just rejects-valid), I think it
warrants a separate report.

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

* [Bug c++/105804] coroutines: List-initialized argument in await expression is doubly freed
  2022-06-01 15:14 [Bug c++/105804] New: List-initialized argument in await expression is doubly freed blubban at gmail dot com
@ 2023-04-16 18:10 ` blubban at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: blubban at gmail dot com @ 2023-04-16 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

Alfred Agrell <blubban at gmail dot com> changed:

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

--- Comment #1 from Alfred Agrell <blubban at gmail dot com> ---
Looks like this one was fixed at some point. Probably by commit
r13-6702-gea4dd8f512979db247c54d6b41377bb73699bcd7, as reported in bug 103871.

Good job, GCC team.

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

end of thread, other threads:[~2023-04-16 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 15:14 [Bug c++/105804] New: List-initialized argument in await expression is doubly freed blubban at gmail dot com
2023-04-16 18:10 ` [Bug c++/105804] coroutines: " blubban 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).