From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AC3093858C41; Sun, 4 Feb 2024 14:14:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC3093858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707056090; bh=/FByqqlO6zPG39poWeVAURM/QWod1azSlCg5rQDwwmA=; h=From:To:Subject:Date:From; b=FDSuIISwiEPgdQ0HbX8PRnzWYaJuVCYMrlmmuETTd2gkE8o5LtFxW1lMgj/ugF8j9 4+mznZgO1k79A0YR0dFS05/BwvAaMA5CDKgBay7bQVPOHfD1kghKCRnwOUnaf4uTlT Cx4rzaUAm2TEgY5zT+QIEyBOFIPtdG3C2jafF4OI= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113756] New: Wrong code at -O2 on x86_64-linux-gnu since r14-2780-g39f117d6c87 Date: Sun, 04 Feb 2024 14:14:50 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: shaohua.li 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 keywords bug_severity priority component assigned_to reporter cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113756 Bug ID: 113756 Summary: Wrong code at -O2 on x86_64-linux-gnu since r14-2780-g39f117d6c87 Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch CC: aldyh at redhat dot com Target Milestone: --- gcc at -O2 produced the wrong code. Bisected to r14-2780-g39f117d6c87 Compiler explorer: https://godbolt.org/z/qWd4196h6 % cat reduced.c int printf(const char *, ...); int d, e, i, k, l =3D -8; char h, j; int m(int n, int o, int p3) { int a =3D o - p3, b =3D n - p3, c =3D a + b, f =3D -b, g =3D c < 0 ? -c := c; return a <=3D f && a <=3D g ? o : p3; } void q(int *n, unsigned short o) { unsigned p =3D 8896; for (; e >=3D 0; e--) p =3D 5377; for (; h <=3D 0; h++) for (; j <=3D 0; j++) { *n =3D 1611581749; i =3D m(34, p - 5294, *n - 1611581687); k =3D i + p + 65535 + o + *n - 1611718251; printf("%d\n", k); } } int main() { q(&l, l); } % % gcc -O0 reduced.c &&./a.out 0 % gcc -O2 reduced.c &&./a.out 21 %=