From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 05FF63858005; Tue, 4 Jul 2023 17:20:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05FF63858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688491209; bh=OWyP0T45zUXl5DxoadJMMBmy/w+nHvI3/AG3OVQZvCo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pA/iPCCy16vjU90sl1ihakwpfWK7stv3qg6biQNxmGaJQ6iO/DslSjo9dATp3w5SV GsmjAZK3YH2hOJ5aArwSsZOVhQUvUVZqvvTFVJ5XPC7f5H++80a512gGfeHnhKwG4c gZhgpuQwK331ydJJHvI30wcE1vL5fJTyo4FjJSmU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110487] [12/13/14 Regression] invalid wide Boolean value Date: Tue, 04 Jul 2023 17:20:08 +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: cvs-commit 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: 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=3D110487 --- Comment #12 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:2e5c1b123d5bc4b7eca91f1eb2dab88d0bcdfcfa commit r14-2298-g2e5c1b123d5bc4b7eca91f1eb2dab88d0bcdfcfa Author: Andrew Pinski Date: Fri Jun 30 17:50:08 2023 -0700 Fix PR 110487: invalid signed boolean value This fixes the first part of this bug where `a ? -1 : 0` would cause a value of 1 into the signed boolean value. It fixes the problem by casting to an integer type of the same size/signedness before doing the negative and then casting to the type of expression. OK? Bootstrapped and tested on x86_64. gcc/ChangeLog: * match.pd (a?-1:0): Cast type an integer type rather the type before the negative. (a?0:-1): Likewise.=