From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B9553858D1E; Sun, 26 Mar 2023 02:16:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B9553858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679797015; bh=mynQYfHiQdqrwvLY3m/FyhjLcJGXbRR/KL9SNrcRTMU=; h=From:To:Subject:Date:From; b=n75rt25On4gO92g3zHIOjDZ3O2BV/ZAN8yUGRdXzgXd2rrT39MHqmOUa846x6ctPy /gRyQdKHj+OmxZOAAY2PndtOFuHm9sQyQxayjZ8u9bXvvneqh6hzg843zyOOnByaWj uo9rZ6jPMacaeO3m+PidoPujm/PtUeMMNll6ql7U= From: "ncm at cantrip dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109283] New: Destructor of co_yield conditional argument called twice Date: Sun, 26 Mar 2023 02:16:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ncm at cantrip dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109283 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=3D54754&action=3Dedit 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=20 twice. Full reproducer attached, relying on Casey Carter's=20 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-binut= ils-2.38) 13.0.1 20230325 (experimental) the compiler ICEs: :513:1: internal compiler error: in flatten_await_stmt, at cp/coroutines.cc:2899 513 | }=