Hello,

this fixes the ADA parts of PR middle-end/48989. For Fortran I am
still looking, what actual the cause is.

ChangeLog

2011-05-16  Kai Tietz

        PR middle-end/48989
        * gcc-interface/trans.c (Exception_Handler_to_gnu_sjlj): Use
        boolean_false_node instead of integer_zero_node.
        (convert_with_check): Likewise.
        * gcc-interface/decl.c (choices_to_gnu): Likewise.
        * gcc-interface/misc.c (gnat_init): Set precision for
        generated boolean_type_node and initialize
        boolean_false_node.

Patch bootstrapped on x86_64-pc-linux-gnu. And ran testsuite for ada.
Ok for apply?

Regards,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/gcc/ada/gcc-interface/trans.c
===================================================================
--- gcc.orig/gcc/ada/gcc-interface/trans.c      2011-05-15 22:39:17.506308700 
+0200
+++ gcc/gcc/ada/gcc-interface/trans.c   2011-05-15 23:28:32.502581600 +0200
@@ -3563,7 +3563,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id g
      an "if" statement to select the proper exceptions.  For "Others", exclude
      exceptions where Handled_By_Others is nonzero unless the All_Others flag
      is set. For "Non-ada", accept an exception if "Lang" is 'V'.  */
-  tree gnu_choice = integer_zero_node;
+  tree gnu_choice = boolean_false_node;
   tree gnu_body = build_stmt_group (Statements (gnat_node), false);
   Node_Id gnat_temp;
 
@@ -3575,7 +3575,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id g
       if (Nkind (gnat_temp) == N_Others_Choice)
        {
          if (All_Others (gnat_temp))
-           this_choice = integer_one_node;
+           this_choice = boolean_true_node;
          else
            this_choice
              = build_binary_op
@@ -7101,7 +7101,7 @@ convert_with_check (Entity_Id gnat_type,
     {
       /* Ensure GNU_EXPR only gets evaluated once.  */
       tree gnu_input = gnat_protect_expr (gnu_result);
-      tree gnu_cond = integer_zero_node;
+      tree gnu_cond = boolean_false_node;
       tree gnu_in_lb = TYPE_MIN_VALUE (gnu_in_basetype);
       tree gnu_in_ub = TYPE_MAX_VALUE (gnu_in_basetype);
       tree gnu_out_lb = TYPE_MIN_VALUE (gnu_base_type);
Index: gcc/gcc/ada/gcc-interface/decl.c
===================================================================
--- gcc.orig/gcc/ada/gcc-interface/decl.c       2011-05-09 10:05:49.000000000 
+0200
+++ gcc/gcc/ada/gcc-interface/decl.c    2011-05-15 23:23:19.470831600 +0200
@@ -6595,7 +6595,7 @@ choices_to_gnu (tree operand, Node_Id ch
 {
   Node_Id choice;
   Node_Id gnat_temp;
-  tree result = integer_zero_node;
+  tree result = boolean_false_node;
   tree this_test, low = 0, high = 0, single = 0;
 
   for (choice = First (choices); Present (choice); choice = Next (choice))
@@ -6660,7 +6660,7 @@ choices_to_gnu (tree operand, Node_Id ch
          break;
 
        case N_Others_Choice:
-         this_test = integer_one_node;
+         this_test = boolean_true_node;
          break;
 
        default:
Index: gcc/gcc/ada/gcc-interface/misc.c
===================================================================
--- gcc.orig/gcc/ada/gcc-interface/misc.c       2011-05-03 18:41:38.000000000 
+0200
+++ gcc/gcc/ada/gcc-interface/misc.c    2011-05-16 14:13:57.610535500 +0200
@@ -326,11 +326,13 @@ gnat_init (void)
   SET_TYPE_RM_MAX_VALUE (boolean_type_node,
                         build_int_cst (boolean_type_node, 1));
   SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1));
+  TYPE_PRECISION (boolean_type_node) = 1;
 
   build_common_tree_nodes_2 (0);
   sbitsize_one_node = sbitsize_int (1);
   sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT);
   boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
+  boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
 
   ptr_void_type_node = build_pointer_type (void_type_node);
 

Reply via email to