From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 31CAA3858D33; Thu, 4 May 2023 22:12:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31CAA3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683238356; bh=Qj88fwiucT0R2odI5tdEASGgrsY1LCOX9r9aLN4GGvA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rBDCGmAIVR+PK/pujNbj4+HcI9UJOW4hEZaO+AH8A6Ak7Hk1z7qitAfmygi50XeE9 1tfh2fJ5/Ja6TK4mgCljAmvQZQrUfTe+hmjqfeNes15IZZD1g6yYzDsodcwLQF1aVD pH3MmD23WFJSY1WJs9JaeVkjlkz5aReZ3bjGfX7E= From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52339] using delete ptr1->ptr2 where ptr2 destructor deletes a const ptr1 fails Date: Thu, 04 May 2023 22:12:35 +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: 4.6.2 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: major X-Bugzilla-Who: jason 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: 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=3D52339 --- Comment #9 from Jason Merrill --- (In reply to Jakub Jelinek from comment #5) > in main it doesn't, as the nop is stripped and the COMPONENT_REF is > TREE_READONLY and !TREE_SIDE_EFFECTS. > tree.cc (save_expr) documents that: > Constants, and certain read-only nodes, are returned with no > SAVE_EXPR because that is safe. Yeah, assuming that TREE_READONLY (t) && !TREE_SIDE_EFFECTS (t) is enough to assume that T won't change seems bogus to me. We could remove that line from tree_invariant_p_1, or restrict it to only a= pply if DECL_P (t) is also true?=