From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4FFC93858D28; Thu, 2 Nov 2023 07:17:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FFC93858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698909474; bh=THsnXjLTuCtuoowB4vv/44nWm1bPmuudWrao0vYrn+U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BvBUDw4KTp5WtXzCyknF9WzWhRc5/yVKMvfdcVZSq830TqpO5WsqZDfBRjSF+kIk4 3Ww/LA7aT79XuiZ/nZ1GwSlnZ5LzoUweXmLHRFenKwZd72I+yUV1QdVU62KN9iWVsp DLDnz23H3dvIpJBN3qrFR9FHHtOfcxGOgQ2f4KkE= From: "federico at kircheis dot it" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112335] missed optimization on reset and assign unique_ptr Date: Thu, 02 Nov 2023 07:17:53 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: federico at kircheis dot it 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: 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=3D112335 --- Comment #2 from Federico Kircheis --- > Well s::~s could touch the reference std::unique_ptr (ps1). In both cases, s::~s is called only once. Also during the move-assignment no user-provided-code is involved (except t= he destruction of ps1, and even case of a user-provided deleter, it is only ca= lled if the pointer is not nullptr.=