+2008-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR, MINUS_EXPR>:
+ New case. Convert BOOLEAN_TYPE operation to the default integer type.
+
2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (DECL_PARM_ALT): Now DECL_PARM_ALT_TYPE.
outputs. */
if (modulus && integer_pow2p (modulus))
modulus = NULL_TREE;
-
goto common;
case COMPLEX_EXPR:
right_operand = convert (sizetype, right_operand);
break;
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ /* Avoid doing arithmetics in BOOLEAN_TYPE like the other compilers.
+ Contrary to C, Ada doesn't allow arithmetics in Standard.Boolean
+ but we can generate addition or subtraction for 'Succ and 'Pred. */
+ if (operation_type && TREE_CODE (operation_type) == BOOLEAN_TYPE)
+ operation_type = left_base_type = right_base_type = integer_type_node;
+ goto common;
+
default:
common:
/* The result type should be the same as the base types of the
+2008-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/boolean_expr2.adb: New test.
+
2008-08-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/36991
--- /dev/null
+-- { dg-do run }
+
+procedure Boolean_Expr2 is
+
+ function Ident_Bool (B : Boolean) return Boolean is
+ begin
+ return B;
+ end;
+
+begin
+ if Boolean'Succ (Ident_Bool(False)) /= True then
+ raise Program_Error;
+ end if;
+
+ if Boolean'Pred (Ident_Bool(True)) /= False then
+ raise Program_Error;
+ end if;
+end;