From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 845FA3959C75; Wed, 27 May 2020 09:40:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 845FA3959C75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590572425; bh=8WfZZispnpY0fLbOzrDyESR8f9N7+H+twzyqLHzp2ZM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SNJeSKD7ra9HDbaWqgWN52r4zCFXqa6rOpvoR4fD1+1Bcz+wsTchveV4Dtk3fPUuI LdlPjIDWNoHLu9wXoEloqjwzuOaOnuVD1aY4WS05AID6ZXcTtmYMSEu4cRgeqT910K 1mI54YsBJw9MQS+OuRmxs5o2pAvgWpdqep2vmhzw= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95349] Using std::launder(p) produces unexpected behavior where (p) produces expected behavior Date: Wed, 27 May 2020 09:40:25 +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: 10.1.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2020 09:40:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95349 --- Comment #3 from rguenther at suse dot de --- On Wed, 27 May 2020, redi at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95349 >=20 > --- Comment #2 from Jonathan Wakely --- > Using=20 >=20 > auto t =3D new(p) std::uint64_t; > std::memcpy(t, std::launder(storage), sizeof(storage)); > return t; >=20 > also prevents GCC from propagating the dynamic type of p to t. So the language lawyer question is whether the testcase is valid or not and what std::launder makes a difference semantics wise (the dynamic type is still transfered, just the compiler no longer knows which one it is).=