From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 38DFE3858D1E; Sat, 15 Oct 2022 20:53:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38DFE3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665867185; bh=t2MmeETA9rxuUuM0ZMcl5hcV/M0V2sCzA+Cq54h8UMY=; h=From:To:Subject:Date:From; b=eJt576+WerTe964pIWdKAXcoxWD0Vk4ewHCbitSxrfHnnecYnBezHYh6/rvl/mOLH mM4KQBHdKHT4l6ymmEqLKuhWAtDRdBI+i94IphsWOa9rTS7jxDhzuNWCFNA8yD8ldQ vQAYVvgWCnMLwGkJ3/Qg3BhDx859Tf8308uXyq2U= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107273] New: wrong code at -O3 on x86_64-linux-gnu Date: Sat, 15 Oct 2022 20:53:04 +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=3D107273 Bug ID: 107273 Summary: wrong code at -O3 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: --- It appears to be a recent regression. Compiler Explorer: https://godbolt.org/z/Mo8sPhYW7 [538] % 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/13.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 --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221015 (experimental) [master r13-3311-gbaeec7cc83b] (= GCC)=20 [539] %=20 [539] % gcctk -O2 small.c; ./a.out [540] %=20 [540] % gcctk -O3 small.c [541] % ./a.out Segmentation fault [542] %=20 [542] % cat small.c int printf(const char *, ...); int a[1] =3D {1}; short b, c =3D 5500; int d; long e; char f =3D 1; int main() { while (1) { long g =3D b < 1; e =3D g; break; } for (; f; f--) { if (e) { d =3D -(6L | -(c & 1000)); } char h =3D d; if (b) b =3D 0; if (d < 200) while (1) printf("%d", a[c]); short i =3D h * 210; c =3D i; } return 0; }=