From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1207F3858D34; Wed, 1 May 2024 02:06:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1207F3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714529197; bh=zju89l2eZx/pfgZCRBcIbLC8aIJMjfw5W92YEYx2rm0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uSB2DIxB/vw9TB3AIEhCPRFZt69Sx07CKfc0O7tA8NjMvqx4ihGuEtlY2ch7FSvSW Zlj+QJ6Oy04XMVBXKAWosRzoh2QIgIIU3uTfoKLukjqhmvcnni/3maVo57u/Sl/Mas VzGYKlbni35EKs3hUtTnF795N5HIuitns/NyocKo= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114902] [14/15 Regression] wrong code at -O3 with "-fno-tree-vrp -fno-expensive-optimizations -fno-tree-dominator-opts" on x86_64-linux-gnu Date: Wed, 01 May 2024 02:06:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone short_desc component bug_status cf_reconfirmed_on everconfirmed cf_gcctarget 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=3D114902 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |14.0 Summary|wrong code at -O3 with |[14/15 Regression] wrong |"-fno-tree-vrp |code at -O3 with |-fno-expensive-optimization |"-fno-tree-vrp |s -fno-tree-dominator-opts" |-fno-expensive-optimization |on x86_64-linux-gnu |s -fno-tree-dominator-opts" | |on x86_64-linux-gnu Component|tree-optimization |target Status|UNCONFIRMED |NEW Last reconfirmed| |2024-05-01 Ever confirmed|0 |1 Target| |x86_64-linux-gnu --- Comment #1 from Andrew Pinski --- Confirmed. Here is a testcase which does not depedent on division by zero trapping: ``` volatile int a, c; unsigned b =3D 1; int main() { a =3D 1; for (; c < 2; c++) { unsigned t =3D 1 & ~b; int e =3D -t; int f =3D -~(!!(1 % a)); if (a =3D=3D 0) __builtin_trap(); if (e >=3D -1) e =3D 1; a =3D e; } return 0; } ``` The testcase works on aarch64-linux-gnu with no issues. The difference between GCC 13 and 14 is on the gimple level but the code lo= oks correct there. In GCC 13 .optimized has: ``` b.0_1 =3D b; _2 =3D b.0_1 & 1; _3 =3D _2 + 4294967295; e_16 =3D (int) _3; _13 =3D e_16 >=3D -1; e_11 =3D _13 ? 1 : e_16; ``` While in 14 .optimized has: ``` b.0_1 =3D b; _2 =3D ~b.0_1; t_13 =3D _2 & 1; _3 =3D -t_13; e_14 =3D (int) _3; _10 =3D e_14 >=3D -1; e_9 =3D _10 ? 1 : e_14; ``` Both are valid and correct. But then it goes wrong after that. I have not looked where though.=