From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BBF5A3858D37; Mon, 11 Sep 2023 07:25:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBF5A3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694417155; bh=0K4SSaw6FOTZW7HzqKwf+hSDnqA6w9VxJRf25eUmEcs=; h=From:To:Subject:Date:From; b=oV88J8oWkfW3UfFsNa4wPViBFFg1YSGvRVkl5xaz3bQXmu4mdeBt8OFeuOsTDLy0V 3+XD0t9NchJvBRikVKdEkou/4fcuicrt5Mshgn8+z5ldBDm9LVND74MSz5bj2ET7tm NelzdXaiM/3/qGNN+ZdSnmBbYxEei/ItlgVv/+X8= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111365] New: Wrong code at -O3 since r13-1268-g8c99e307b20 Date: Mon, 11 Sep 2023 07:25:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: 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 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=3D111365 Bug ID: 111365 Summary: Wrong code at -O3 since r13-1268-g8c99e307b20 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c 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 -O3 produced the wrong code. Bisected to r13-1268-g8c99e307b20 Compiler explorer: https://godbolt.org/z/5rb3sTG3E $ cat a.c int printf(const char *, ...); int a, c, d, e =3D -1233286202, f =3D -1233286202; short b, g, j; int k(int l) { if (l <=3D 0 || &c + l > &d) return -1; return 0; } int m(int l) { int h =3D k(l); return h; } int main() { int i =3D 0; for (; (m(f + 1233286202) + e + (f + 1233286202) + 1233220671) + 65532U + i= < 9; i++) g =3D 6; printf("%d\n", g); } $ $ gcc -O0 a.c && ./a.out 6 $ gcc -O3 a.c && ./a.out 0 $ gcc -fsanitize=3Daddress,undefined a.c && ./a.out 6 $=