From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9C7383858418; Fri, 14 Oct 2022 18:22:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C7383858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665771756; bh=wLaguqbZYvo6GKk9gpXfED1gAcDj+KeHeA2ELUVW9mc=; h=From:To:Subject:Date:From; b=Td41WmG33TpMX0syCle007cCgh3+Z2ffFPqLhQ+AZyZxlSjcrCATm3n8mNWmX9rLk HtpiYGsuLYcDZ6RfXm3fBvutZWvhIrzZnGRkGwHFxIGdvlNCLKgqRhdCHGVB5Zr2aZ PMKQTLMnY2YCNuZ7sQZ7T/p9O+ecz5V0UTBR9rto= From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107269] New: wrong code at -O1 and above with "-fno-tree-ccp" on x86_64-linux-gnu Date: Fri, 14 Oct 2022 18:22:20 +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=3D107269 Bug ID: 107269 Summary: wrong code at -O1 and above with "-fno-tree-ccp" 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/WdcsavxTh [593] % 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 20221014 (experimental) [master r13-3307-g8efc38347a7] (= GCC)=20 [594] %=20 [594] % gcctk -O1 small.c; ./a.out [595] %=20 [595] % gcctk -O1 -fno-tree-ccp small.c [596] % ./a.out Floating point exception [597] %=20 [597] % cat small.c int a, b, f; char c =3D 3; unsigned d =3D 1; short e; int main() { int h =3D 2357999721; char i =3D a =3D 3; for (; a >=3D 0; a--) { int *j =3D &h; char k =3D i || c; short l =3D ~h; b =3D ~(d % h); f =3D ~i / b; if (h >=3D -1936967575) { int m =3D h / d / 110000000 ^ (f & c); short n =3D c; if (h <=3D -1936967575) n =3D e; h =3D m; c =3D ~(n + f); d =3D -1; } i =3D ~l - k; } return 0; }=