decl.c (gnat_to_gnu_entity): Convert integer_one_node to the appropriate type.
authorRichard Sandiford <r.sandiford@uk.ibm.com>
Wed, 14 May 2014 15:42:25 +0000 (15:42 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 14 May 2014 15:42:25 +0000 (15:42 +0000)
gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity): Convert
integer_one_node to the appropriate type.
* gcc-interface/trans.c (gnat_to_gnu): Likewise.
(pos_to_constructor): Likewise.

From-SVN: r210427

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/trans.c

index 7167f97..e84ca90 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-14  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity): Convert
+       integer_one_node to the appropriate type.
+       * gcc-interface/trans.c (gnat_to_gnu): Likewise.
+       (pos_to_constructor): Likewise.
+
 2014-05-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (annotate_value): Fix thinko in latest change.
index 43ed0b3..e18583c 100644 (file)
@@ -2840,7 +2840,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
          = build_binary_op (PLUS_EXPR, gnu_string_index_type,
                             gnu_lower_bound,
                             int_const_binop (MINUS_EXPR, gnu_length,
-                                             integer_one_node));
+                                             convert (gnu_string_index_type,
+                                                      integer_one_node)));
        tree gnu_index_type
          = create_index_type (convert (sizetype, gnu_lower_bound),
                               convert (sizetype, gnu_upper_bound),
index 11b8982..26194b6 100644 (file)
@@ -5597,6 +5597,7 @@ gnat_to_gnu (Node_Id gnat_node)
          int length = String_Length (gnat_string);
          int i;
          tree gnu_idx = TYPE_MIN_VALUE (TYPE_DOMAIN (gnu_result_type));
+         tree gnu_one_node = convert (TREE_TYPE (gnu_idx), integer_one_node);
          vec<constructor_elt, va_gc> *gnu_vec;
          vec_alloc (gnu_vec, length);
 
@@ -5606,7 +5607,7 @@ gnat_to_gnu (Node_Id gnat_node)
                                      Get_String_Char (gnat_string, i + 1));
 
              CONSTRUCTOR_APPEND_ELT (gnu_vec, gnu_idx, t);
-             gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node);
+             gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, gnu_one_node);
            }
 
          gnu_result = gnat_build_constructor (gnu_result_type, gnu_vec);
@@ -9092,7 +9093,9 @@ pos_to_constructor (Node_Id gnat_expr, tree gnu_array_type,
       CONSTRUCTOR_APPEND_ELT (gnu_expr_vec, gnu_index,
                              convert (TREE_TYPE (gnu_array_type), gnu_expr));
 
-      gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node);
+      gnu_index = int_const_binop (PLUS_EXPR, gnu_index,
+                                  convert (TREE_TYPE (gnu_index),
+                                           integer_one_node));
     }
 
   return gnat_build_constructor (gnu_array_type, gnu_expr_vec);