From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7B1F53858D1E; Fri, 22 Mar 2024 19:15:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B1F53858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711134933; bh=6Ib2PV6BheJqp76cUM+4W7rHNcaW8ICLR5ycYsxNU/8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AVVZRdNtDmbi4t4pVrfaodRRFyhRa8Mt9LV8vyUrgRq4VGLwbs+is9NRfzn8nXrnf +h5HL9L6ZTVxRw5W+UQ28BYTUjU77eKIuJS7TQcxspeXy+sZehz3TKbtBeMa+blU9j y7D5+FiDCuMhMAKsCVZONKr6MQB6ZMaZFhYwOspc= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111151] [12/13/14 Regression] Wrong code at -O0 on x86_64-pc-linux-gnu Date: Fri, 22 Mar 2024 19:15:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D111151 --- Comment #12 from Jakub Jelinek --- The following testcase at least reproduces the unsigned multiplication issu= e, but doesn't reproduce the signed multiplication nor division by -1. int main () { unsigned a =3D (1U + __INT_MAX__) / 2U; unsigned b =3D 1U; unsigned c =3D (a * 2U > b * 2U ? a * 2U : b * 2U) * 2U; if (c !=3D 0U) __builtin_abort (); int d =3D (-__INT_MAX__ - 1) / 2; int e =3D 10; int f =3D (d * 2 > e * 2 ? d * 2 : e * 2) * 6; if (f !=3D 120) __builtin_abort (); int g =3D (-__INT_MAX__ - 1) / 2; int h =3D 0; int i =3D (g * 2 > h * 2 ? g * 2 : h * 2) / -1; if (i !=3D 0) __builtin_abort (); }=