From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E8ABC3858D1E; Sat, 15 Oct 2022 20:57:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8ABC3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665867442; bh=1XHCRtgkIiXTEhPuiN6jfb9f1A0tWWJM0ps70sdy+zQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZMVC+VmblXJoXwlGorADI5Y4NAFKPji8SRR9z1jrVZew8wCwPIHaO4GfpmEhV+Mim qwQNTSIwgCL3RNF0jKUpzgX+lxvdXBcOcq4Q46LLG+04olaLsaEPjKbQODqBBPger0 wP+0arU9y9esXb8RrganL+JsBXvlKh24cfTuTtB0= 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 20:57:22 +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 #1 from Zhendong Su --- Likely a related instance (although it fails also at -Os and -O2 besides -O= 3). Compiler Explorer: https://godbolt.org/z/rdajs47K6 [515] % 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) [516] % [516] % gcctk -O1 small.c; ./a.out [517] % [517] % gcctk -Os small.c [518] % ./a.out Illegal instruction [519] % [519] % cat small.c int a, d, f; char b, g; unsigned i; int main() { int c =3D 300, h =3D 40; char e =3D 1; for (; a < 1; a++) { c =3D ~((i - ~c) | e); L1: e =3D f =3D c; if (c) if (c > -200) e =3D g % (1 << h); char k =3D 0; L2:; } if (b) { if (d) goto L2; if (!b) goto L1; } return 0; }=