This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[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)
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Nov 2016 12:38:31 +0000
- Subject: [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)
- Auto-submitted: auto-generated
- References: <bug-78429-4@http.gcc.gnu.org/bugzilla/>
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.