[Bug middle-end/78429] [6/7 Regression] ice on valid C code on x86_64-linux-gnu at -O3 in both 32-bit and 64-bit modes (internal compiler error: in set_value_range, at tree-vrp.c:361)
ebotcazou at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 21 12:45:00 GMT 2016
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.
More information about the Gcc-bugs
mailing list