https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110487
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:2e5c1b123d5bc4b7eca91f1eb2dab88d0bcdfcfa commit r14-2298-g2e5c1b123d5bc4b7eca91f1eb2dab88d0bcdfcfa Author: Andrew Pinski <apin...@marvell.com> 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.