From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 068853861828; Wed, 26 Jun 2024 10:06:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 068853861828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719396409; bh=hQxcqBfbJm1koQ2/VI9KaPkexcGcwjrswrQz1DDfiHw=; h=From:To:Subject:Date:From; b=uwLhUXpf6SGESQnF8/+8Re4YM7jBE7dbRCQ2ytRSJgueDcMTcob4j2Lw9Gp3Wi/34 E7uMbJwLGr/PPdn/Sti3aTHH1BYzDkFbSbtCTJftJO3SMJHAQpiU6pOnQm7aBveCSh djVUG59FHpOqOi5z4oQ3QEL0eqCW7Aum2m11BrPw= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115661] New: wrong code at -O{2,3} on x86_64-linux-gnu Date: Wed, 26 Jun 2024 10:06:48 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhendong.su 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=3D115661 Bug ID: 115661 Summary: wrong code at -O{2,3} on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- This appears to be a recent regression as it doesn't reproduce with 14.1. Compiler Explorer: https://godbolt.org/z/1dneGGoTE [517] % gcctk -v Using built-in specs. COLLECT_GCC=3Dgcctk COLLECT_LTO_WRAPPER=3D/local/suz-local/software/local/gcc-trunk/libexec/gcc= /x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --enable-checking=3Dyes --prefix=3D/local/suz-local/software/local/gcc-trunk --enable-sanitizers --enable-languages=3Dc,c++ --disable-werror --enable-mu= ltilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240626 (experimental) (GCC)=20 [518] %=20 [518] % gcctk -O0 small.c; ./a.out [519] % gcctk -O2 small.c [520] % ./a.out 0 [521] % cat small.c int printf(const char *, ...); int a, b[6], c =3D 2, d, e =3D 446984904, *g, h, *i =3D &b[5]; int *m() { int *f =3D &c; if (d < 6) return &b[5]; return f; } void n() { int j; for (; a < 1; a++) for (j =3D 0; j < 1; j++) { g =3D m(); int k =3D *g; if (k) { int l =3D (3504049682 + e) & 3504049682; h =3D ~(k * l) * 7455084268; if (h > -1436818931) { printf("0\n"); continue; } return; } } } int main() { *i =3D 1; n(); return 0; }=