From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3FF963858C74; Thu, 8 Sep 2022 21:37:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FF963858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662673042; bh=JjxpWTlKk+RuXlP62tiB/1KSulICINZgfPblTlDSWB4=; h=From:To:Subject:Date:From; b=d7zSXoI880xwSY+MOqzXo+zC9sk1l6UfBHYt5q2g7s8Ujzk8jz07l0fSx5rPZp9Ib /biz5OkiSotJrYx0Eqbw+5xTteXlqlhNhYJONzpFzX8YOVbHMzBjkujzKdbMetGkdA wWtRflC4vE7fKvxE7ubNBkh4gJoyMcwn+rv+zKmA= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106892] New: Wrong code at -O3 on x86_64-linux-gnu Date: Thu, 08 Sep 2022 21:37:22 +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: 13.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 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=3D106892 Bug ID: 106892 Summary: Wrong code at -O3 on x86_64-linux-gnu Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch Target Milestone: --- $ gcc-tk -v Using built-in specs. COLLECT_GCC=3Dgcc-tk COLLECT_LTO_WRAPPER=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-75f59= 441cd63a1d07e86d70d59c518049f53904f/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/= lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --enable-languages=3Dc,c++ --prefix=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-75f59441cd63a1d0= 7e86d70d59c518049f53904f Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220830 (experimental) (GCC) $ $ gcc-tk -w -O0 simple.c && ./a.out 0 $ gcc-tk -w -O0 simple.c && ./a.out 3 $=20 $ cat simple.c a, b, c, d, e; f[8]; g() { while (a) a >>=3D 4; } h(i) { if (i >=3D '0') return i - '0'; } j(i) { b =3D 2; for (; g() <=3D 7; b++) if (i) { for (; e <=3D 7; e++) { c =3D 1; for (; c <=3D 7; c++) { d =3D h(b + 48); f[-d + 4] ^=3D 3; } } return; } } main() { j(1); printf("%d\n", f[2]); } $=