From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5193D3858D32; Tue, 31 Oct 2023 11:13:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5193D3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698750814; bh=RfMLnKYacKH3Wc1xz8u1LidoHWebucx9Nj4ei9uIaYI=; h=From:To:Subject:Date:From; b=hWKV+f/IQi4FNN840XKM2SoCylZEAfneiAGDP6dGlxnBajeb6avcaSU43SGDMT4Nl rQKjcJVcB2bLgqwsh5a/sCojn6nDNz8SKRlDtQEmWe9N3u5u78hmKMK6Hp75uGiygY sXpTQQ4wEkcf9K7Uz7+llL9iXmrxF9xSJDXr/DKY= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112310] New: [14 Regression] Wrong code at -O2/3 on x86_64-linux-gnu since r14-1161-g5476de2618f Date: Tue, 31 Oct 2023 11:13:33 +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=3D112310 Bug ID: 112310 Summary: [14 Regression] Wrong code at -O2/3 on x86_64-linux-gnu since r14-1161-g5476de2618f 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: rguenth at gcc dot gnu.org Target Milestone: --- gcc at -O2/3 produces the wrong code. Bisected to r14-1161-g5476de2618f Compiler explorer: https://godbolt.org/z/Kb4qMKE9K $ cat a.c int printf(const char *, ...); short a, b; static int c, d, e, f =3D -7; char g; int *h =3D &d; int **i =3D &h; int j; short(k)(int l) { return l >=3D 2 ? 0 : l; } int(m)(int l, int n) { return l < -2147483647 / n ? l : l * n; } void o() { &c; } int main() { { int p; for (; g <=3D 3; g++) { for (; c; c++) ; a =3D 2; for (; a <=3D 7; a++) { short *r =3D &b; p =3D m(*h, 2022160547); unsigned q =3D 2022160547; e =3D p * q; *r ^=3D e; j =3D k(c + 3); **i =3D 0; } *i =3D &f; } } printf("%d\n", b); } $ $ gcc -O0 a.c && ./a.out -3189 $ gcc -O2 a.c && ./a.out 0 $=