https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78429

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> where -1 no longer "fits" bool even though it should.  So
> 
>   /* Short-circuit boolean types since various transformations assume that
>      they can only take values 0 and 1.  */
>   if (TREE_CODE (type) == BOOLEAN_TYPE)
>     return eq_p (x, 0) || eq_p (x, 1);
> 
> is wrong and should use eq_p (x, -1) instead as bool is signed?  The
> int_fits_type_p function is likely wrong as well (uses integer_onep).

Standard boolean types as unsigned though, not signed:

Index: tree.c
===================================================================
--- tree.c      (revision 242632)
+++ tree.c      (working copy)
@@ -8218,7 +8218,7 @@ build_nonstandard_boolean_type (unsigned

   type = make_node (BOOLEAN_TYPE);
   TYPE_PRECISION (type) = precision;
-  fixup_signed_type (type);
+  fixup_unsigned_type (type);

   if (precision <= MAX_INT_CACHED_PREC)
     nonstandard_boolean_type_cache[precision] = type;

fixes the ICE.

Reply via email to