From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B5603858D32; Mon, 17 Oct 2022 10:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B5603858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666002434; bh=yriX6sPe3lKsfL8JPezEFhCseRSwgwrSpYT7wnRCl9c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aemccrXF09w86PKAz4Ui8PAWE7mznyLUqnci0NPhwvkMgLqwPkM/aX7iJJBDDgtA7 f2jxOpZPVVb18jHO6rPzBj8YTkt1mRhvzlhaz7A3U9SwIkU4RrObdoHDhJtw7cZhjy XPrTU1QRh09HlcqZWr1pftn/ObOVnkDg5eoxInSI= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107257] Wrong code at -O2 on x86_64-linux-gnu Date: Mon, 17 Oct 2022 10:27:13 +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: 13.0 X-Bugzilla-Keywords: needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: shaohua.li at inf dot ethz.ch X-Bugzilla-Status: NEW 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: resolution bug_status 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=3D107257 Li Shaohua changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |--- Status|RESOLVED |NEW --- Comment #4 from Li Shaohua --- Hi, Sorry for my previous over-reduced test case. Here is a well-formed reduct= ion: ``` void printf(); int a, b, c; int d[3]; int e(int f, int g, int k, int l, int m, int n) { int h =3D 4 * f + 2 * (g + l + n) + k + m, j =3D h >> 4; return j; } void o(int f) { int i =3D 0; for (; i < 3; i++) d[i] =3D 4279432140; for (; - 72 + f - -72 <=3D 2; f++) { a =3D 2; for (; a >=3D 0; a--) { b =3D 2; for (; b >=3D 0; b--) { int p =3D !(d[b] > 0 !=3D e(10, 29, 42, 74, 89, -68) + f - 15); if (p) break; } if (f) break; } } } void q() { int i =3D 0; o(0); if (c) for (; i < 1;) for (; i < 1; i++) ; } int main() { q(); printf("%d\n", b); } ``` Compiler explorer: https://godbolt.org/z/bjjW5q17r=