From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AA123858417; Tue, 9 Apr 2024 21:03:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AA123858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712696583; bh=MDBeAXk2DmBwaFEdu1AN7QzGyC3gRGdaV0OLQvSQ+YE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CBKHTUWnwG3m5LdXuD3S0DGYyNC7GpAttWYURQwjpKyHE+RhUFJb2/GYLzpADW4e1 wAUQSSCeb0akZtxsQ/eWS5kUoR9tT5vMFzKscY5OZeg5daaA+EtXenWFBZNH41sqyj GkoYNpENf6B01+ct+Dc+XhKhNw/j924n58JXKlCg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114666] [14 Regression] Signed single bit comparison miscompile at -O2 Date: Tue, 09 Apr 2024 21:03:02 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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=3D114666 --- Comment #4 from Andrew Pinski --- Note the other pattern which uses logical_inverted_value where it depends on the type does: /* -(type)!A -> (type)A - 1. */ (simplify (negate (convert?:s (logical_inverted_value:s @0))) (if (INTEGRAL_TYPE_P (type) && TREE_CODE (type) !=3D BOOLEAN_TYPE && TYPE_PRECISION (type) > 1 && TREE_CODE (@0) =3D=3D SSA_NAME && ssa_name_has_boolean_range (@0)) (plus (convert:type @0) { build_all_ones_cst (type); }))) But that is ok because of the check of >1 for precision. The other one deal= ing with cond is a problem there.=