From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C708384AB5B; Tue, 23 Apr 2024 18:29:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C708384AB5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713896994; bh=Zota74w5waRj8jPC1RGqt05yaSiDdQy6K2W3naPXEE4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wfJK/zm/JVijnISE3r1a+AYtRcYmxLSutfZ6vPsUJr8lJl2et9/OOMb9e5fEYDBEY 1QiqMu0TD+agByKfPIRN0vzKlzJW30HBXJJFbehRUfNUe4n+xV0ZB8CDBxCtnd/zaW y0HGnhkQdDQXLBxTsu9dLdMPUIY3hcSS9tws0Ll8= From: "arthur.j.odwyer at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114817] Wrong codegen for std::copy of "trivially copyable but not trivially assignable" type Date: Tue, 23 Apr 2024 18:29:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: arthur.j.odwyer at gmail dot com 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=3D114817 --- Comment #1 from Arthur O'Dwyer --- Yes, vector reallocation has analogous trouble with types that are "trivial, but not trivially copy constructible." https://godbolt.org/z/Psboqf3MP (libc++ happens to sidestep this pitfall *on Clang 15+,* because libc++ gat= es their vector reallocation optimization differently depending on whether `__has_builtin(__is_trivially_relocatable)`; but libc++ would have the same= bug as libstdc++ when compiled on GCC.)=