From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C2C03858D37; Fri, 30 Jun 2023 01:38:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C2C03858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688089091; bh=Mdrk7b7Slzp3ebIvB8Fj0t+tBGdG7plJHSo+CUj5Z/Y=; h=From:To:Subject:Date:From; b=ppZkdcCU3C6zdSVZdJ/OM02JepEA01reGGcifnVBeaIImLM7hHEKOmE9cnayPUJDy iF1NJ53/E9B0dypTD48GLOsVGUAmQrO4lMPK0X3aYk1PG3GM4UQSkXCiWbwdK26orE Zblp3SG2QdVvwAtlGXg4aCje2TKgvjFY1TEhmrvM= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/110491] New: Wrong code at -O2 on x86_64-linux-gnu (a recent regression) Date: Fri, 30 Jun 2023 01:38:10 +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=3D110491 Bug ID: 110491 Summary: Wrong code at -O2 on x86_64-linux-gnu (a recent regression) 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: --- gcc at -O2 produced wrong code. Compiler explorer: https://godbolt.org/z/cbM1q13G7 $ cat a.c int printf(const char *, ...); int a, c, d, e; short b; void f(int *g) { c &=3D *g; } void h(void); void i() { a =3D 1; h(); f(&a); } void h() { int *j =3D &c; *j =3D 5; k: for (; 4 + b <=3D 0;) ; for (; d;) { c =3D e =3D=3D 0; goto k; } } int main() { i(); printf("%d\n", c); } $ $ gcc-tk -O0 a.c &&./a.out 1 $ gcc-tk -O2 a.c && ./a.out -2003318871 $ $ gcc-tk -v Using built-in specs. COLLECT_GCC=3Dgcc-tk COLLECT_LTO_WRAPPER=3D/zdata/shaoli/compilers/ccbuilder-compilers/gcc-5f590= ee3174cf6058ac882c3a84a96ae639349c8/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-5f590ee3174cf605= 8ac882c3a84a96ae639349c8 Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230629 (experimental) (GCC) $=