From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D771B3858D32; Sun, 21 Apr 2024 11:54:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D771B3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713700457; bh=Z58xWfnEW196AgY0BNDYKf0vJWpp3heezqnTWu6lAos=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XJXb3gwoOG4HpPJpiQQ21QLfX7EuMEM7RbVkqN8V41f8lKYOwhKIWw0ViEsvquJUo nX+Tg+2fUkrIqcKF0b55c7KwC/kJX9fDFP6dmMJJTmpjIwWaAkPXf2LHf8Sg9zufTx nH0y2apbBLQhkRIUICsrHbytV5pirRZri5veOh2M= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114793] wrong code at -O1 with "-fschedule-insns2 -fselective-scheduling2" on x86_64-linux-gnu (the generated code hangs) Date: Sun, 21 Apr 2024 11:54:17 +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=3D114793 --- Comment #1 from Zhendong Su --- The following reproducer is different, but perhaps is the same or related. Compiler Explorer: https://godbolt.org/z/411rzMP1n [588] % 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/14.0.1/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 14.0.1 20240421 (experimental) (GCC)=20 [589] %=20 [589] % gcctk -O1 -fno-tree-forwprop -fselective-scheduling2 -fschedule-ins= ns2 -fsel-sched-pipelining small.c [590] % ./a.out Aborted [591] %=20 [591] % cat small.c int printf(const char *, ...); int a, d, g, h; volatile int b =3D 1; static unsigned c =3D 1; char e, f =3D 1, i; static int j() { int k, l =3D g, m =3D 1 << l, n =3D -e, o =3D -1 % ((f && 1) ^ i), p =3D = ~n - o; if (m) { int q, s, t, r =3D 1 % (((1 % f) & (~e | c)) ^ b); q =3D f; s =3D i; t =3D e; f =3D -b; k =3D f; d =3D -1; u: e =3D 0 & b; if (i > f) if (!b) goto v; if (d > t) __builtin_abort(); if (b < 1 || !d || !c) { printf("%d\n", i); f =3D ((i | b) & (k - r)) << (e << ~t ^ q) << s; goto u; } if (i) f =3D q; v: i =3D n & o & l; printf("%ld\n", (long)t); } i =3D p; return h; } int main() { for (; a < 3; a++) j(); return 0; }=