> I noticed while debugging why my "A?CST1:CST0" patch was broken for > Ada, I noticed the following ranges for boolean types: > # RANGE [0, 1] NONZERO 1 > _14 = checks__saved_checks_tos.482_2 > 0; > # RANGE [0, 255] NONZERO 1 > _18 = _14 == 0; > _19 = ~_18;
The '~' looks problematic if this is for Ada code, it ought to be: _19 = _18 ^ 1; See below. > Should TYPE_UNSIGNED be always set for boolean types? > > I am testing the below patch to see if it fixes the problem, if we > should assume TYPE_UNSIGNED is true for boolean types. If we should > not assume that, then there is a problem with conversion between > boolean types that have TYPE_UNSIGNED mismatched. The patch is a nop, boolean types are always unsigned in Ada, see cstand.adb: Set_Is_Unsigned_Type (Standard_Boolean); but they have 8-bit precision instead of 1-bit precision so must be handled with care, in particular BIT_NOT_EXPR should be avoided for them, see e.g. the gimplifier: if (TYPE_PRECISION (TREE_TYPE (*expr_p)) == 1) *expr_p = build1_loc (input_location, BIT_NOT_EXPR, TREE_TYPE (*expr_p), TREE_OPERAND (*expr_p, 0)); else *expr_p = build2_loc (input_location, BIT_XOR_EXPR, TREE_TYPE (*expr_p), TREE_OPERAND (*expr_p, 0), build_int_cst (TREE_TYPE (*expr_p), 1)); -- Eric Botcazou