From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E764E3951C4F; Fri, 13 Nov 2020 22:17:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E764E3951C4F From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97821] New: wrong code with -ftree-vectorize at -O1 on x86_64-pc-linux-gnu Date: Fri, 13 Nov 2020 22:17:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhendong.su at inf dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 13 Nov 2020 22:17:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97821 Bug ID: 97821 Summary: wrong code with -ftree-vectorize at -O1 on x86_64-pc-linux-gnu Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- The code is valid, but it is hard to reduce, so still quite large. [509] % gcctk -v Using built-in specs. COLLECT_GCC=3Dgcctk COLLECT_LTO_WRAPPER=3D/local/suz-local/software/local/gcc-trunk/libexec/gcc= /x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --prefix=3D/local/suz-local/software/local/gcc-trunk --enable-languages=3Dc= ,c++ --disable-werror --enable-multilib --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20201113 (experimental) [master revision 54896b10dbe:c3a97a9df4b:a514934a0565255276adaa4fbd4aa35579ec33c6] (GCC)=20 [510] %=20 [510] % gcctk -O1 small.c; ./a.out 00005030-170 [511] % gcctk -O1 -ftree-vectorize small.c; ./a.out 00005030-176 [512] %=20 [512] % cat small.c int printf (const char *, ...); static unsigned a, f, v; int b, h, aa, ab, ac, ad, ae, y, z, af; static long c, m, t, ag, ah =3D 3; static signed d; static char e, ai; static short g, j =3D 1, o, w; int *i, *s; long long l; static int *n; char p; static int q; static int r; static int u; short x; long long *aj =3D &l; static signed ak; static volatile unsigned al =3D 5; static volatile short am =3D 1; int *an(int *ao, int *ap) { return ap; } static int aq() { int ar[] =3D {2, 2, 2, 2, 2, 2}; short *as =3D &x; int at[] =3D {0, 1, 0, 1}; int au =3D ab =3D 0; for (; m <=3D 1; m++) { int av =3D 0, k, aw =3D e && u, ax =3D aw || ag; int **ay =3D &n; for (; ab; ab++) ac =3D 0; for (; ac; ac++) am; u &&am; short az =3D am || a ^ w; unsigned bc =3D am & w | am || ag; ba: aw =3D u; i =3D 0; for (; i; i++) b =3D a; printf("0"); if (p) { printf("%ld", ag); continue; } if (ag) { printf("7"); e =3D w | ag c < ax; } if (w) { printf("%d", u); goto bb; } if (u) printf("%d", e); s =3D &k; u =3D aw; t =3D 0; for (; t <=3D 1; t++) *ay =3D an(&au, &av); e++; } for (; r >=3D 0;) for (; ag <=3D 5;) { signed bd[6]; int be =3D 0, bf =3D am % al; for (; be < 6; be++) bd[0] =3D 9; h =3D 0; for (; h <=3D 5; h++) *aj =3D *as =3D aa; for (; w; w =3D d) ; short bg =3D d + j ^ e + r; al % am; int bi =3D bg & al >> am; am ^ al; am / al; am &al; al; am / al; if (c) if (q) { be =3D 0; for (; be; be++) z =3D 0; } am; int bj =3D 0; if (m || q) { bh: l =3D ad =3D c; int bm =3D al || q; al; al; char bn =3D al || q; al; al; bm =3D q; ae =3D a; bk: ai =3D h || q > d; ag =3D d; al; al; printf("%d", q); if (a > 1) break; if (q) printf("%d", d); if (q) { printf("3"); h =3D d | bm > q; goto bk; } if (!ai || al && 0) { printf("%d", d); al; printf("%d", a); goto bb; } d =3D al; printf("%lld", l); m =3D q; if (ak) { printf("%ld", c); ad =3D c & q; } if (!ah) { printf("%d", q); goto bh; } } if (c) s =3D &bj; m =3D q =3D d && c; r =3D ~(e / j & al > r); f |=3D d =3D al; v |=3D am; al / al ^ am; ak =3D am + al | al; am / al + al ^ am; j =3D am; al; bb: if (c) g++; a =3D q || e & d; am || al; am; am; am; al &am; am; am; bl: am; if (q) { printf("%d", q); a =3D q - am; goto bl; } am; printf("%d", d); m =3D q & am; am; printf("%d", a); if (d < -41) { printf("%ld", ag); goto ba; } h =3D *n; printf("3"); c =3D e / d; printf("%ld", m); d =3D d << q / ag; o =3D 2; for (; o; o++) i =3D &be; x =3D m =3D e; printf("%d", r) && (ah =3D r) || (d =3D ak && e); printf("%d", ak); if (!bf) { printf("%d", e); *as =3D a; i =3D n; bi =3D ak / am > r; *n =3D 0; for (; n; n++) ; } y =3D bi; } return 0; } int main() { for (; af < 6; af++) { d =3D 8; aq(); } printf("%d\n", h); return 0; }=