public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109283] New: Destructor of co_yield conditional argument called twice
@ 2023-03-26  2:16 ncm at cantrip dot org
  2023-03-29  7:11 ` [Bug c++/109283] " StevenSun2021 at hotmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ncm at cantrip dot org @ 2023-03-26  2:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109283
           Summary: Destructor of co_yield conditional argument called
                    twice
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ncm at cantrip dot org
  Target Milestone: ---

Created attachment 54754
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54754&action=edit
Reproducer

Basically:

  co_yield a ? s : t;

segfaults,

  if (a) co_yield s; else co_yield t;

does not. The segfault traces to s/t's destructor being called 
twice. Full reproducer attached, relying on Casey Carter's 
generator implementation, pasted in.

This may be related to 101367.

Compiled with gcc-12.2, this program segfaults.
Compiled with gcc-trunk or gcc-coroutines on Godbolt, identified as:

  g++
(Compiler-Explorer-Build-gcc-13ec81eb4c3b484ad636000fa8f6d925e15fb983-binutils-2.38)
13.0.1 20230325 (experimental)

the compiler ICEs:

  <source>:513:1: internal compiler error: in flatten_await_stmt, at
cp/coroutines.cc:2899
  513 | }

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

end of thread, other threads:[~2024-05-26  4:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26  2:16 [Bug c++/109283] New: Destructor of co_yield conditional argument called twice ncm at cantrip dot org
2023-03-29  7:11 ` [Bug c++/109283] " StevenSun2021 at hotmail dot com
2023-03-29 15:45 ` ncm at cantrip dot org
2023-05-08 14:23 ` ncm at cantrip dot org
2024-02-05 14:23 ` redi at gcc dot gnu.org
2024-05-20 16:10 ` accelerator0099 at gmail dot com
2024-05-26  4:55 ` accelerator0099 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).