trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 20 Dec 2017 09:38:47 +0000 (09:38 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 20 Dec 2017 09:38:47 +0000 (09:38 +0000)
* gcc-interface/trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.
* gcc-interface/misc.c (gnat_get_array_descr_info): Likewise.
(default_pass_by_ref): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.

From-SVN: r255854

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

index e9f217346ad669a9de0ac63e8c8a4cf25375a0e3..d06ddffa0c95f9a9cef324faf9cf0a6923b5c2f4 100644 (file)
@@ -1,9 +1,16 @@
+2017-12-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.
+       * gcc-interface/misc.c (gnat_get_array_descr_info): Likewise.
+       (default_pass_by_ref): Likewise.
+       * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.
+
 2017-12-19  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc-interface/trans.c (Loop_Statement_to_gnu): Replace Yoda
        conditions with typical order conditions.
-       * gcc-interface/misc.c (gnat_get_array_descr_info,
-       default_pass_by_ref): Likewise.
+       * gcc-interface/misc.c (gnat_get_array_descr_info): Likewise.
+       (default_pass_by_ref): Likewise.
        * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.
        * adaint.c (__gnat_tmp_name): Likewise.
 
index 84fd588d2387e345f03932d227cfc79de2201f44..20d35f3a5dc1bfa3e8447d100f9d83ad5dd56423 100644 (file)
@@ -2111,7 +2111,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
           index to the template.  */
        for (index = (convention_fortran_p ? ndim - 1 : 0),
             gnat_index = First_Index (gnat_entity);
-            index >= 0 && index < ndim;
+            IN_RANGE (index, 0, ndim - 1);
             index += (convention_fortran_p ? - 1 : 1),
             gnat_index = Next_Index (gnat_index))
          {
@@ -2362,7 +2362,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
               gnat_index = First_Index (gnat_entity),
               gnat_base_index
                 = First_Index (Implementation_Base_Type (gnat_entity));
-              index >= 0 && index < ndim;
+              IN_RANGE (index, 0, ndim - 1);
               index += (convention_fortran_p ? - 1 : 1),
               gnat_index = Next_Index (gnat_index),
               gnat_base_index = Next_Index (gnat_base_index))
index 3eda489a36d7b7d31603a75712f44745e3c0cce5..7401d2df27fc44009541f6edef9480728e151fc3 100644 (file)
@@ -953,7 +953,7 @@ gnat_get_array_descr_info (const_tree const_type,
      structure.  */
   for (i = (convention_fortran_p ? info->ndimensions - 1 : 0),
        dimen = first_dimen;
-       i >= 0 && i < info->ndimensions;
+       IN_RANGE (i, 0, info->ndimensions - 1);
        i += (convention_fortran_p ? -1 : 1),
        dimen = TREE_TYPE (dimen))
     {
index 7e7bac9aa4a3e5957e42e7b239a7474ecbc478fd..9f34718f16d82801266d34b00928002674099513 100644 (file)
@@ -3190,8 +3190,9 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
 
          /* Note that loop unswitching can only be applied a small number of
             times to a given loop (PARAM_MAX_UNSWITCH_LEVEL default to 3).  */
-         if (n_remaining_checks > 0 && n_remaining_checks <= 3
-             && optimize > 1 && !optimize_size)
+         if (IN_RANGE (n_remaining_checks, 1, 3)
+             && optimize > 1
+             && !optimize_size)
            FOR_EACH_VEC_ELT (*gnu_loop_info->checks, i, rci)
              if (rci->invariant_cond != boolean_false_node)
                {