From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C30773858C83; Wed, 1 Mar 2023 14:34:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C30773858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677681278; bh=GGHervki5gjcC4DcU7L5f88a/F7Lz/09O/ZpXr/b0AQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NJoLfQ55iiLV1C0W38Oa9ny8f6lpTSxilpKWXEYksjCXclWblNDFoqlqiay+VbclF Vc3Q2DHTYoMa6LM9pK0JtT0YInl/eTKMd9vZZP3TZpf3Flo39Usi47Ln5Qrk3rg9mu tYd7Yl7S7DETt1rd0AKSmgJ7Eu/j1d5DtopmrD3Q= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107561] [13 Regression] g++.dg/pr71488.C and [g++.dg/warn/Warray-bounds-16.C -m32] regression due to -Wstringop-overflow problem Date: Wed, 01 Mar 2023 14:34:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D107561 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #16 from Jakub Jelinek --- (In reply to Richard Biener from comment #15) > The compiler doesn't know that the allocation function cannot clobber *th= is. > The C++ frontend tries to communicate this by making 'this' restrict > qualified > and we make use of that info, but for calls we do not know how to use the > info. >=20 > Maybe we can special-case directly the actual parameter case and compute > the restrictness info for the call arguments. The canonical example is >=20 > void bar (void); > struct X { > X (int); > int i; > int j; > }; >=20 > X::X(int k) > { > i =3D k; > bar (); > j =3D i !=3D k; > } >=20 > where if I understand you correctly, bar () is not allowed to modify *this > (unless I pass it an argument to it, of course), even if *this is for > example Why? Because it is a constructor and the object isn't fully constructed ye= t at that point? For normal methods I certainly don't see anything that would preclude such modifications.=