From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E90783854543; Tue, 29 Nov 2022 12:01:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E90783854543 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669723292; bh=Uzz5cKGve+zLPWrXQvAcmvy0OXfQOzTeqLHPPVwcmRs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=B/zW83LGFRIba7W1EWwE196tyKeh7yPMsEoBtEUw8uPuk/U4sf0UTApw5KhmUJuRJ rsRKfUAddOhP75xfPFE4wZ774yUKqr1yuPifMojCmDEZMIUA9XB//quq1VH9Bw14vv YWFpGRTl6oPsY2XSMyl6PGtPTlb7vM2+B2/5aO94= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107852] [12/13 Regression] Spurious warnings stringop-overflow and array-bounds copying data as bytes into vector Date: Tue, 29 Nov 2022 12:01:32 +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: 12.2.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: redi 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: 12.3 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=3D107852 --- Comment #6 from Jonathan Wakely --- As Martin S. suggested a few times, it would be nice if we had an attribute= or something that could say that no members of 'this' are clobbered like that.= It would be UB for the vector's allocator (whether it's using operator new or malloc or something else) to re-enter any of the vector's member functions while in the middle of resizing it. Or maybe some kind of pragma that says that for the duration of the current scope, the 'this' pointer should be assumed to be unreachable to global functions (such as operator new). Something like "#pragma GCC unescape(this= )"=