From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D3383858C2F; Thu, 8 Jun 2023 21:43:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D3383858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686260604; bh=NHl56FbTGsGgT5fn/NauuAkgIaKCjbKCaixZqg17Z4o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n4yaRmYXUv95yjXmK68/Q+EugFrgWqkrngD5g/nuXSBfdlYkW/8u/kRbpKDNQFpny L+qMeCny7sjdKY3GFdk2JRH62P40jbAZPlZ39o1X53e5OBPll0m7osisKUmZ3z62Sk PzCQd6IxKvHQ0pMNmvFCJQZp7gO196iQ98mzbdb0= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110176] wrong code at -Os and above on x86_64-linux-gnu Date: Thu, 08 Jun 2023 21:43:24 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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=3D110176 --- Comment #1 from Andrew Pinski --- Fre turns: b.2_4 =3D b; _5 =3D b.2_4 =3D=3D 0; _6 =3D (int) _5; _7 =3D _6 <=3D i_19; _8 =3D (int) _7; b =3D _8; Into: b.2_4 =3D b; _5 =3D b.2_4 =3D=3D 0; _6 =3D (int) _5; b =3D 1; Which is wrong as _6 <=3D -1 is always 0. (simplify (cmp (convert@0 @00) (convert?@1 @10)) ... tree min =3D lower_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00)); tree max =3D upper_bound_in_type (TREE_TYPE (@10), TREE_TYPE (@00)); bool above =3D integer_nonzerop (const_binop (LT_EXPR, type, max, @10)); bool below =3D integer_nonzerop (const_binop (LT_EXPR, type, @10, min)); ... (if (above || below) ... { constant_boolean_node (above ? true : false, type); }=