From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7D6743943405; Tue, 20 Oct 2020 06:47:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D6743943405 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97474] [8/9/10/11 Regression] produces wrong code with references to another field Date: Tue, 20 Oct 2020 06:47:12 +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: 11.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 8.5 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 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: Tue, 20 Oct 2020 06:47:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97474 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.or= g, | |ppalka at gcc dot gnu.org --- Comment #10 from Jakub Jelinek --- I think the place in the C++ FE that adds restrict here is: tree type_passed_as (tree type) { /* Pass classes with copy ctors by invisible reference. */ if (TREE_ADDRESSABLE (type)) { type =3D build_reference_type (type); /* There are no other pointers to this temporary. */ type =3D cp_build_qualified_type (type, TYPE_QUAL_RESTRICT); } So, the options are either not to do it for types that contain any pointers/references among its members, or do some extra analysis as to whet= her even if it contains some pointers/references if those are guaranteed not to point to anything within the structure (e.g. because of TBAA rules), or usi= ng that analysis decide if it can use normal restrict or needs to use a weaker restrict, etc.=