From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A2863858D37; Fri, 3 Nov 2023 14:23:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A2863858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699021413; bh=y8T1rsRYJYlfAGi4efw1lwGdMm3/k+BkixSzlVu5Xw8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YgP5+mbFDvVBePBj3AuR/jsH6nQa2/J7N2O583UcbUhNOCR7YNVYcEW6zb8UOharv PkBNaiBcii3rzFeZxN0zi3H7T194SR40c+ZEgVP1iJ60B9ez3omeagFpmGH83kZJaH Xl+BXCotZtmrjZRSq/zz/f1HuDUxY3mPsSXTlmxw= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112335] missed optimization on reset and assign unique_ptr Date: Fri, 03 Nov 2023 14:23:33 +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: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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 #10 from Jonathan Wakely --- Ah, now I understand what you've been saying about the postcondition. Yes, but the compiler doesn't know the postcondition, it's just words in the standard, so not visible to the optimization passes. It might be possible to add some optimization hints to the std::unique_ptr implementation to make the postcondition visible to the optimizer.=