From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7AD0938515F3; Thu, 12 May 2022 09:54:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AD0938515F3 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105562] std::function::_M_invoker may be used uninitialized in std::regex move with -fno-strict-aliasing Date: Thu, 12 May 2022 09:54:12 +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.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.2 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: Thu, 12 May 2022 09:54:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105562 --- Comment #10 from Richard Biener --- (In reply to Jakub Jelinek from comment #9) > Perhaps with -fno-strict-aliasing we think the store to *this might alias > with it? Though, that shouldn't be about TBAA but simple points-to > analysis, where obviously this as function argument can't point to a local > var in the function. It's the MEM[(long unsigned int *)_12 + -8B] =3D{v} {CLOBBER}; store, __tmp escapes in the indirect call _48 (&MEM[(struct _Function_base *)&__tmp + 16B]._M_functor,=20=20=20 &MEM[(struct _Function_base *)&__tmp + 16B]._M_functor, 3); and _12 points to escaped (its loaded from this). I guess since a CLOBBER isn't technically a "store" we could ignore it and continue looking for data to load. If it would alias then we'd access (partly) 'uninitialized' memory which would invoke undefined behavior.=