From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B1E553858D28; Mon, 17 Jul 2023 13:26:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1E553858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689600376; bh=VJeoY2zspBbjxkdoKgLq731mZcOypTQQgned8ufQe+4=; h=From:To:Subject:Date:From; b=e5QJUcbga19Mvt2vl4vLnMSq5TbQXkvn1kyAg6UAHerCeggjTFLbS1j2ktRtqxc3m P34bsf7sk/Zj44yq7+Gcfi/Z7GQRGqU4ZM7T9CK9XAVy38g0tLXq+FPVsg7Ai2rQxx BynutVSlVmhADkq9FjZqHf8/Y1l1iqZvz8hwjBb8= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/110702] New: Wrong code at -O1 on x86_64-linux-gnu (regression since GCC-12.2) Date: Mon, 17 Jul 2023 13:26:16 +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 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=3D110702 Bug ID: 110702 Summary: Wrong code at -O1 on x86_64-linux-gnu (regression since GCC-12.2) 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 Target Milestone: --- This looks like a regression since GCC-12.2. Compiler explorer: https://godbolt.org/z/655af97j7 $ cat a.c int printf(const char *, ...); int a, b, c, d; long e[9][7][4]; void f() { for (; a >=3D 0; a--) { b =3D 0; for (; b <=3D 3; b++) { c =3D 0; for (; c <=3D 3; c++) { int *g =3D &d; *g =3D e[0][0][b] | e[a][b][a]; } } } } int main() { f(); printf("%d\n", a); } $ $ gcc-tk -O0 a.c && ./a.out -1 $ gcc-tk -O1 a.c && ./a.out 0 $ $ gcc-tk -v Using built-in specs. COLLECT_GCC=3Dgcc-tk COLLECT_LTO_WRAPPER=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-322d1= 7ae51ea0137167424e0018d7fa355948f9f/libexec/gcc/x86_64-pc-linux-gnu/14.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-322d17ae51ea0137= 167424e0018d7fa355948f9f Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230711 (experimental) (GCC)=20 $=