From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7428A385AE44; Fri, 24 Jun 2022 08:06:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7428A385AE44 From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106073] New: wrong code at -O3 on x86_64-linux-gnu Date: Fri, 24 Jun 2022 08:06:01 +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: unknown 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, 24 Jun 2022 08:06:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106073 Bug ID: 106073 Summary: wrong code at -O3 on x86_64-linux-gnu Product: gcc Version: unknown 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: --- It seems to be a regression from 11.*. The test is still quite complicated,= but seems difficult to be reduced much further.=20 [507] % 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/13.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-sanitizers --enable-languages=3Dc,c++ --disable-werror --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220624 (experimental) [master r12-4647-g3f861a5c8fd] (= GCC)=20 [508] %=20 [508] % gcctk -O2 small.c; ./a.out [509] %=20 [509] % gcctk -O3 small.c [510] % ./a.out Aborted [511] %=20 [511] % cat small.c int a, f =3D 1, h, l, m =3D 1, o, r =3D 4, q, s, x, e, aa, ab, ac, *ad, ae = =3D 5, **y, **af, ag, ah, ai, aj; static int c[6], d, g[6][5], n, *v =3D &s, ak; volatile int p; const volatile int al; static volatile int t, u, w =3D 3, z, am, an; static int ao(); void ap(); static void aq() { int ar[4] =3D {6, 6, 6, 6}, as[1], i, j; as[0] =3D 0; if (m) { int at[11] =3D {4, 4, 6, 5, 7, 0, 7, 6, 7, 6, 6}, *au, *av[7], k; au =3D (int*) &au; for (i =3D 0; i < 1; i++) for (j =3D 0; j < 1; j++) for (k =3D 0; k < 7; k++) { (t || n) && u; av[k] =3D 0; } y =3D av; while (o) { int *b[2] =3D {as, ar}; *af =3D at; } m =3D 0; } } inline void ap() { for (; l <=3D 4; l++) { *v =3D 0; aq(); if (a) break; for (; q; q++) ; } } int ao() { int be =3D 0, j; if (n) aa =3D d =3D 0; l =3D 0; for (; be < 2; be++) { int bf[7][2]; for (ai =3D 0; ai < 7; ai++) for (j =3D 0; j < 2; j++) bf[ai][j] =3D 5; if (be) { for (; h >=3D 0; h--) { while (z >=3D w) { ap(); *ad =3D 0; } ap(); } return bf[3][0]; } if (bf[3][0]) continue; while (1) ; } return 0; } static void aw() { for (; ah; ah++) { p =3D 0; p =3D 0; } int ax =3D ~e; L1: e =3D a =3D 0; L2: if (!r) goto L3; if (!ax) goto L2; if (d) goto L1; if (!ae) goto L1; if (w && x <=3D 808 && f) ag =3D ao(); g[0][4] =3D ag; if (a) { int bd; n++; while (n) for (bd =3D 0; bd < 7; bd++) { am; am; am; am; d =3D c[d ^ am]; } } else { L3: an; for (; ak; ak++) { int bc =3D 7; for (; bc >=3D 0; bc--) { al; al; d =3D f && an; an; } } } } int main() { int k; for (; aj < 6; aj++) c[0] =3D aj; aw(); for (aj =3D 0; aj < 6; aj++) for (k =3D 0; k < 5; k++) d =3D c[d ^ g[aj][k]]; if (d !=3D 5) __builtin_abort(); return 0; }=