From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CAE933AA88FD; Thu, 17 Nov 2022 14:58:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAE933AA88FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668697100; bh=OI8w8wZNX990Bv6sAx+ZGJyT4S9RwI6rUrkOkscvuhI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pXxDLwgSd/IIQeZ9w5+irqXYmp8eFgsia8OAXQ825ByfamULiJv1ORNUB/jsR0Zh/ jM+CR8eNpo9tAc8ajjeHyvSbr0tOwqEdL8PI5bzWY5Mdfbq/KnMuL9Ojm4QfMvYIdm MyynJVzW+Yw0C6KTRDf5sVNWj1XyGSRnqDtZblts= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107451] [11/12/13 Regression] Segmentation fault with vectorized code since r11-6434 Date: Thu, 17 Nov 2022 14:58:20 +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: 11.3.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107451 --- Comment #10 from Richard Biener --- Interestingly the following variant of the testcase falls back to VMAT_ELEMENTWISE but does have the same problem there fixed up by later folding, but it will segfault when using -O2 -mavx2 -fno-vect-cost-model -fdisable-tree-vrp2 -fdisable-free-forwprop4 which then keeps the bogus _62 =3D *ivtmp_64; _61 =3D MEM[(const double *)ivtmp_64 + 8B]; ivtmp_60 =3D ivtmp_64 + _65; _59 =3D *ivtmp_60; _58 =3D MEM[(const double *)ivtmp_60 + 8B]; ivtmp_57 =3D ivtmp_60 + _65; vect_cst__56 =3D {_62, _61, _59, _58}; vect__4.7_55 =3D VEC_PERM_EXPR ; that problem should be present even before the r11-6434 change. In fact this segfaults on the GCC 10 branch with just -O2 -ftree-loop-vectorize -ma= vx2 generating the same load/permute as trunk for the reduction (so there's some half-way "fix" on the later branches). Also broken with GCC 9.5. static void __attribute__((noipa)) setdot(int n, const double *x, int inc_x, const double *y, double * __restr= ict dot) { int i, ix =3D 0; for(i =3D 0; i < n; i++) { dot[i*4+0] =3D x[ix] * y[ix] ; dot[i*4+1] =3D x[ix+1] * y[ix+1] ; dot[i*4+2] =3D x[ix] * y[ix+1] ; dot[i*4+3] =3D x[ix+1] * y[ix] ; ix +=3D inc_x ; } } int main(void) { double x[2] =3D {0, 0}, y[2] =3D {0, 0}; double dot[4]; setdot(1, x, 4096*4096, y, dot); return 0; }=