From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 63A80385840A; Mon, 30 Oct 2023 16:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63A80385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698683378; bh=7c87mn/xTNrvp9QW4MgR5hVvV0q34+TxjWJnfZdZHvI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=asIBWz6dhHzJnrWJMZ77v3oIjza4N7Mq/kRlv34xm+xF+Wd8GdyRS2zamLMVPPu8H ep+bqE8+2euNfH2Y3Y+t4KWJyTp6b4Bt/9cZMxWeZlH9btOQYnZxIOfCZn/mgZoirU ZnLyrGZUGRs2LsVEryKLoFMWeV5RFbY5xMw3rVL0= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112301] [Regression 12/13/14] Double destruction of returned object when exiting the scope causes an exception which gets rethrown Date: Mon, 30 Oct 2023 16:29:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW 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: keywords short_desc cc cf_reconfirmed_on bug_status everconfirmed Message-ID: In-Reply-To: References: 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=3D112301 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Summary|Double destruction of |[Regression 12/13/14] |returned object when |Double destruction of |exiting the scope causes an |returned object when |exception which gets |exiting the scope causes an |rethrown |exception which gets | |rethrown CC| |jason at gcc dot gnu.org Last reconfirmed| |2023-10-30 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- Confirmed as a regression starting with r12-6333-gb10e031458d541 Author: Jason Merrill Date: Wed Jan 5 22:01:12 2022 c++: destroy retval on throwing cleanup in try [PR33799] My earlier attempt to fix this bug didn't handle the case where both the return and the throwing cleanup are within a try-block that catches and discards the exception. Fixed by adding the retval cleanup to any try-blocks as well as the function body. PR102191 pointed out that we = also weren't handling templates properly, so I moved the call out of the par= ser. PR c++/33799 PR c++/102191=