From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7EDC7398883C; Tue, 26 Jan 2021 08:29:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EDC7398883C From: "rguenther at suse dot de" 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, 26 Jan 2021 08:29:44 +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: rguenther at suse dot de 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: 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, 26 Jan 2021 08:29:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97474 --- Comment #13 from rguenther at suse dot de --- On Mon, 25 Jan 2021, jason at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97474 >=20 > --- Comment #12 from Jason Merrill --- > Yeah, adding restrict there is just wrong; the constructor is called outs= ide > the function, and could e.g. stash a pointer to the object in a global > variable. What we actually want is to treat this reference parameter lik= e a > value parameter. Is that information actually useful to the optimizers? It's a layout hint PTA can use but without restricting who can point to said object it's not going to affect precision much (in fact I'd have to double check that giving hinting a wrong object size by passing the base "value" of a derived class object won't cause issues). ISTR we've explored keying on REFERENCE_TYPE only (for said layout hint) in the past.=