OSDN Git Service

* trans-array.c (gfc_trans_preloop_setup): Use loop's dimension instead
[pf3gnuchains/gcc-fork.git] / gcc / fortran / trans-array.c
index 91359e9..476978e 100644 (file)
@@ -2861,25 +2861,24 @@ gfc_trans_preloop_setup (gfc_loopinfo * loop, int dim, int flag,
 
       if (dim >= info->dimen)
        continue;
+      gcc_assert (info->dimen == loop->dimen);
 
       if (info->ref)
-       {
-         ar = &info->ref->u.ar;
-         i = loop->order[dim + 1];
-       }
+       ar = &info->ref->u.ar;
       else
-       {
-         ar = NULL;
-         i = dim + 1;
-       }
+       ar = NULL;
+
+      if (dim == loop->dimen - 1)
+       i = 0;
+      else
+       i = dim + 1;
 
+      /* For the time being, there is no loop reordering.  */
+      gcc_assert (i == loop->order[i]);
+      i = loop->order[i];
 
-      if (dim == info->dimen - 1)
+      if (dim == loop->dimen - 1)
        {
-         i = loop->order[0];
-         /* For the time being, the innermost loop is unconditionally on
-            the first dimension of the scalarization loop.  */
-         gcc_assert (i == 0);
          stride = gfc_conv_array_stride (info->descriptor, info->dim[i]);
 
          /* Calculate the stride of the innermost loop.  Hopefully this will