From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 988BA383443E; Tue, 23 Feb 2021 13:30:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 988BA383443E From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/99117] [9/10/11 Regression] cannot accumulate std::valarray Date: Tue, 23 Feb 2021 13:30:49 +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: 10.1.0 X-Bugzilla-Keywords: 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: 9.4 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, 23 Feb 2021 13:30:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99117 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm28 at gcc dot gnu.org --- Comment #14 from Jakub Jelinek --- (In reply to Richard Biener from comment #13) > So the valarray behavior boils down to >=20 > struct _Array { int * __restrict m_data; }; >=20 > void foo (struct _Array dest, int *src, int n) > { > for (int i =3D 0; i < n; ++i) > dest.m_data[i] =3D src[i]; > } >=20 > which we treat similarly: >=20 > _8 =3D MEM[(int *)_3 clique 1 base 0]; > MEM[(int *)_7 clique 1 base 1] =3D _8; >=20 > and thus we'd vectorize "bogously" for example if src =3D=3D dest.m_data = + 1 I'd argue that passing such src to the function is invalid (for C, sure, C++ doesn't have restrict). Because src is not based on dest.m_data in that case. So, the big question is what passes that pointer that aliases it.=