From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D461D3858D38; Sat, 15 Oct 2022 21:00:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D461D3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665867631; bh=4sfW9+xt/dj07uzZYYHjOgbGHoCEIuhOu3QpxzBC3a8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eAoDDAhtjaGKXnN/lpghASmsWxaLUsO1P4ntX/FbdaoPvCxoXseee/FzNzN+WJ77T eEOA3wz7jMhEXKSRpyCXlL9qcRSuFoTSGlX4F294FdJgP4SKMWA5KJQPqvM3zbJkka CtdjCB83FPZ8W1fMBUu0noWqiTLA8J14NMnLxn/Y= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107273] wrong code at -O3 on x86_64-linux-gnu Date: Sat, 15 Oct 2022 21:00:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: Message-ID: In-Reply-To: References: 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 --- Comment #2 from Zhendong Su --- Another likely related instance that is miscompiled at -O1 and above. Compiler Explorer: https://godbolt.org/z/xqz7f4c7v [570] % 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 [571] %=20 [571] % gcctk -O0 small.c; ./a.out [572] %=20 [572] % gcctk -O1 small.c [573] % timeout -s 9 5 ./a.out Killed [574] % cat small.c int a =3D 1, b, c; int main() { unsigned d =3D 1; char e =3D 1, f =3D 150; if (f > 0) goto L2; L1: d =3D -(d << a || f); if (a) L2: f =3D ~e; char i =3D 1 ^ d; if (b) { e =3D d | c; goto L2; } if (a < 1) goto L1; while (!d) ; return 0; }=