From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B1333858C52; Tue, 10 Oct 2023 20:54:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B1333858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696971268; bh=qTKpveh2/37B2X5DOwZWPYRVrFLbw5kKszyJD5nZ2yo=; h=From:To:Subject:Date:From; b=lxdggc2+MhkRw2vCooVa5eF9cVCqUz7WyiPkybo9BeMC7fIKopeHYzgQIQ1skEX5h z5CNSC4OgB3Ucc1o7JKAZCUkDJpRWySBa1Vmm9zLHkQ57DwwH1mdKA6kX/UJbVWWV1 9+Jip7mxCBrQh6XyCm8Pufmc9ZBf4jDjmZUtYonE= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111764] New: Wrong code at -O3 on x86_64-linux-gnu since r11-5965-g04bff1bbfc1 Date: Tue, 10 Oct 2023 20:54:27 +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=3D111764 Bug ID: 111764 Summary: Wrong code at -O3 on x86_64-linux-gnu since r11-5965-g04bff1bbfc1 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 -O3 produced the wrong code. Bisected to r11-5965-g04bff1bbfc1 Compiler explorer: https://godbolt.org/z/7vaqadYfP $ cat a.c int printf(const char *, ...); char a; short b, c; static short *d =3D &b, *e =3D &b; short(f)(short g, short h) { return g * h; } int main() { *e =3D 2; a =3D 1; for (; a <=3D 9; a++) { short *i =3D &c; *i =3D *d =3D f(*e, *e); } printf("%d\n", c); } $ $ gcc -O0 a.c && ./a.out 0 $ gcc -O3 a.c && ./a.out 4 %=