OSDN Git Service

* gcc.pot: Regenerate.
[pf3gnuchains/gcc-fork.git] / libgfortran / generated / sum_i4.c
index e8c60c3..7ad317c 100644 (file)
@@ -84,15 +84,15 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
       size_t alloc_size, str;
 
       for (n = 0; n < rank; n++)
-        {
-          if (n == 0)
+       {
+         if (n == 0)
            str = 1;
-          else
-            str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+         else
+           str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
 
          GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
 
-        }
+       }
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -119,19 +119,8 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
                       (long int) rank);
 
       if (unlikely (compile_options.bounds_check))
-       {
-         for (n=0; n < rank; n++)
-           {
-             index_type ret_extent;
-
-             ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
-             if (extent[n] != ret_extent)
-               runtime_error ("Incorrect extent in return value of"
-                              " SUM intrinsic in dimension %ld:"
-                              " is %ld, should be %ld", (long int) n + 1,
-                              (long int) ret_extent, (long int) extent[n]);
-           }
-       }
+       bounds_ifunction_return ((array_t *) retarray, extent,
+                                "return value", "SUM");
     }
 
   for (n = 0; n < rank; n++)
@@ -139,7 +128,7 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
       count[n] = 0;
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
       if (extent[n] <= 0)
-        len = 0;
+       len = 0;
     }
 
   base = array->data;
@@ -154,7 +143,7 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
       {
 
   result = 0;
-        if (len <= 0)
+       if (len <= 0)
          *dest = 0;
        else
          {
@@ -162,7 +151,7 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
              {
 
   result += *src;
-          }
+             }
            *dest = result;
          }
       }
@@ -172,28 +161,28 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
       dest += dstride[0];
       n = 0;
       while (count[n] == extent[n])
-        {
-          /* When we get to the end of a dimension, reset it and increment
-             the next dimension.  */
-          count[n] = 0;
-          /* We could precalculate these products, but this is a less
-             frequently used path so probably not worth it.  */
-          base -= sstride[n] * extent[n];
-          dest -= dstride[n] * extent[n];
-          n++;
-          if (n == rank)
-            {
-              /* Break out of the look.  */
+       {
+         /* When we get to the end of a dimension, reset it and increment
+            the next dimension.  */
+         count[n] = 0;
+         /* We could precalculate these products, but this is a less
+            frequently used path so probably not worth it.  */
+         base -= sstride[n] * extent[n];
+         dest -= dstride[n] * extent[n];
+         n++;
+         if (n == rank)
+           {
+             /* Break out of the look.  */
              continue_loop = 0;
              break;
-            }
-          else
-            {
-              count[n]++;
-              base += sstride[n];
-              dest += dstride[n];
-            }
-        }
+           }
+         else
+           {
+             count[n]++;
+             base += sstride[n];
+             dest += dstride[n];
+           }
+       }
     }
 }
 
@@ -273,15 +262,15 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
       size_t alloc_size, str;
 
       for (n = 0; n < rank; n++)
-        {
-          if (n == 0)
-            str = 1;
-          else
-            str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+       {
+         if (n == 0)
+           str = 1;
+         else
+           str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
 
          GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
 
-        }
+       }
 
       alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
                   * extent[rank-1];
@@ -306,29 +295,10 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
 
       if (unlikely (compile_options.bounds_check))
        {
-         for (n=0; n < rank; n++)
-           {
-             index_type ret_extent;
-
-             ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
-             if (extent[n] != ret_extent)
-               runtime_error ("Incorrect extent in return value of"
-                              " SUM intrinsic in dimension %ld:"
-                              " is %ld, should be %ld", (long int) n + 1,
-                              (long int) ret_extent, (long int) extent[n]);
-           }
-          for (n=0; n<= rank; n++)
-            {
-              index_type mask_extent, array_extent;
-
-             array_extent = GFC_DESCRIPTOR_EXTENT(array,n);
-             mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n);
-             if (array_extent != mask_extent)
-               runtime_error ("Incorrect extent in MASK argument of"
-                              " SUM intrinsic in dimension %ld:"
-                              " is %ld, should be %ld", (long int) n + 1,
-                              (long int) mask_extent, (long int) array_extent);
-           }
+         bounds_ifunction_return ((array_t *) retarray, extent,
+                                  "return value", "SUM");
+         bounds_equal_extents ((array_t *) mask, (array_t *) array,
+                               "MASK argument", "SUM");
        }
     }
 
@@ -337,7 +307,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
       count[n] = 0;
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
       if (extent[n] <= 0)
-        return;
+       return;
     }
 
   dest = retarray->data;
@@ -353,7 +323,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
       {
 
   result = 0;
-        if (len <= 0)
+       if (len <= 0)
          *dest = 0;
        else
          {
@@ -362,7 +332,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
 
   if (*msrc)
     result += *src;
-              }
+             }
            *dest = result;
          }
       }
@@ -373,30 +343,30 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
       dest += dstride[0];
       n = 0;
       while (count[n] == extent[n])
-        {
-          /* When we get to the end of a dimension, reset it and increment
-             the next dimension.  */
-          count[n] = 0;
-          /* We could precalculate these products, but this is a less
-             frequently used path so probably not worth it.  */
-          base -= sstride[n] * extent[n];
-          mbase -= mstride[n] * extent[n];
-          dest -= dstride[n] * extent[n];
-          n++;
-          if (n == rank)
-            {
-              /* Break out of the look.  */
-              base = NULL;
-              break;
-            }
-          else
-            {
-              count[n]++;
-              base += sstride[n];
-              mbase += mstride[n];
-              dest += dstride[n];
-            }
-        }
+       {
+         /* When we get to the end of a dimension, reset it and increment
+            the next dimension.  */
+         count[n] = 0;
+         /* We could precalculate these products, but this is a less
+            frequently used path so probably not worth it.  */
+         base -= sstride[n] * extent[n];
+         mbase -= mstride[n] * extent[n];
+         dest -= dstride[n] * extent[n];
+         n++;
+         if (n == rank)
+           {
+             /* Break out of the look.  */
+             base = NULL;
+             break;
+           }
+         else
+           {
+             count[n]++;
+             base += sstride[n];
+             mbase += mstride[n];
+             dest += dstride[n];
+           }
+       }
     }
 }
 
@@ -414,7 +384,6 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
-  index_type sstride[GFC_MAX_DIMENSIONS];
   index_type dstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   index_type rank;
@@ -433,7 +402,6 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
 
   for (n = 0; n < dim; n++)
     {
-      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
       extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
 
       if (extent[n] <= 0)
@@ -442,12 +410,11 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
 
   for (n = dim; n < rank; n++)
     {
-      sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
       extent[n] =
-        GFC_DESCRIPTOR_EXTENT(array,n + 1);
+       GFC_DESCRIPTOR_EXTENT(array,n + 1);
 
       if (extent[n] <= 0)
-        extent[n] = 0;
+       extent[n] = 0;
     }
 
   if (retarray->data == NULL)
@@ -455,15 +422,15 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
       size_t alloc_size, str;
 
       for (n = 0; n < rank; n++)
-        {
-          if (n == 0)
-            str = 1;
-          else
-            str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+       {
+         if (n == 0)
+           str = 1;
+         else
+           str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
 
          GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
 
-        }
+       }
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -519,21 +486,21 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
       dest += dstride[0];
       n = 0;
       while (count[n] == extent[n])
-        {
+       {
          /* When we get to the end of a dimension, reset it and increment
-             the next dimension.  */
-          count[n] = 0;
-          /* We could precalculate these products, but this is a less
-             frequently used path so probably not worth it.  */
-          dest -= dstride[n] * extent[n];
-          n++;
-          if (n == rank)
+            the next dimension.  */
+         count[n] = 0;
+         /* We could precalculate these products, but this is a less
+            frequently used path so probably not worth it.  */
+         dest -= dstride[n] * extent[n];
+         n++;
+         if (n == rank)
            return;
-          else
-            {
-              count[n]++;
-              dest += dstride[n];
-            }
+         else
+           {
+             count[n]++;
+             dest += dstride[n];
+           }
        }
     }
 }