OSDN Git Service

2008-09-06 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / maxloc1_8_i4.c
index 82038dc..469a480 100644 (file)
@@ -57,12 +57,15 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   index_type len;
   index_type delta;
   index_type dim;
+  int continue_loop;
 
   /* Make dim zero based to avoid confusion.  */
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len < 0)
+    len = 0;
   delta = array->dim[dim].stride;
 
   for (n = 0; n < dim; n++)
@@ -121,7 +124,7 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
                       (long int) (GFC_DESCRIPTOR_RANK (retarray)),
                       (long int) rank);
 
-      if (compile_options.bounds_check)
+      if (unlikely (compile_options.bounds_check))
        {
          for (n=0; n < rank; n++)
            {
@@ -149,7 +152,8 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   base = array->data;
   dest = retarray->data;
 
-  while (base)
+  continue_loop = 1;
+  while (continue_loop)
     {
       const GFC_INTEGER_4 * restrict src;
       GFC_INTEGER_8 result;
@@ -193,8 +197,8 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
           if (n == rank)
             {
               /* Break out of the look.  */
-              base = NULL;
-              break;
+             continue_loop = 0;
+             break;
             }
           else
             {
@@ -314,7 +318,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       if (rank != GFC_DESCRIPTOR_RANK (retarray))
        runtime_error ("rank of return array incorrect in MAXLOC intrinsic");
 
-      if (compile_options.bounds_check)
+      if (unlikely (compile_options.bounds_check))
        {
          for (n=0; n < rank; n++)
            {
@@ -504,7 +508,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
                       (long int) (GFC_DESCRIPTOR_RANK (retarray)),
                       (long int) rank);
 
-      if (compile_options.bounds_check)
+      if (unlikely (compile_options.bounds_check))
        {
          for (n=0; n < rank; n++)
            {