]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
iresolve.c (resolve_bound, [...]): Don't set the shape for assumed rank arrays.
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 2 Aug 2012 19:10:38 +0000 (19:10 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 2 Aug 2012 19:10:38 +0000 (19:10 +0000)
* iresolve.c (resolve_bound, gfc_resolve_shape):
Don't set the shape for assumed rank arrays.
* simplify.c (gfc_simplify_shape): Don't try to simplify if the
argument is assumed rank.

From-SVN: r190094

gcc/fortran/ChangeLog
gcc/fortran/iresolve.c
gcc/fortran/simplify.c

index 979f28cb985f951b0164502a89cd2c9dbd61d17f..94bb958aa5f1998f00ef79639e18eefbfcde4d7e 100644 (file)
@@ -1,3 +1,10 @@
+2012-08-02  Mikael Morin  <mikael@gcc.gnu.org>
+
+       * iresolve.c (resolve_bound, gfc_resolve_shape):
+       Don't set the shape for assumed rank arrays.
+       * simplify.c (gfc_simplify_shape): Don't try to simplify if the
+       argument is assumed rank.
+
 2012-08-02  Mikael Morin  <mikael@gcc.gnu.org>
 
        * array.c (gfc_copy_array_ref): Don't copy the offset field.
index 6d1e8b2a1766e9263b3556b08d31964e2130d194..3f981d88c1bd5b685ec281ed3531a80901486046 100644 (file)
@@ -134,9 +134,12 @@ resolve_bound (gfc_expr *f, gfc_expr *array, gfc_expr *dim, gfc_expr *kind,
   if (dim == NULL)
     {
       f->rank = 1;
-      f->shape = gfc_get_shape (1);
-      mpz_init_set_ui (f->shape[0], coarray ? gfc_get_corank (array)
-                                           : array->rank);
+      if (array->rank != -1)
+       {
+         f->shape = gfc_get_shape (1);
+         mpz_init_set_ui (f->shape[0], coarray ? gfc_get_corank (array)
+                                               : array->rank);
+       }
     }
 
   f->value.function.name = xstrdup (name);
@@ -2225,8 +2228,12 @@ gfc_resolve_shape (gfc_expr *f, gfc_expr *array, gfc_expr *kind)
     f->ts.kind = gfc_default_integer_kind;
 
   f->rank = 1;
-  f->shape = gfc_get_shape (1);
-  mpz_init_set_ui (f->shape[0], array->rank);
+  if (array->rank != -1)
+    {
+      f->shape = gfc_get_shape (1);
+      mpz_init_set_ui (f->shape[0], array->rank);
+    }
+
   f->value.function.name = gfc_get_string (PREFIX ("shape_%d"), f->ts.kind);
 }
 
index c12675ee4df69ce07ec7a0be0e9b0c33fe3ce37d..e4ccddf967cb764577bc4b06db4b36666ef122b0 100644 (file)
@@ -5470,6 +5470,9 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind)
   gfc_try t;
   int k = get_kind (BT_INTEGER, kind, "SHAPE", gfc_default_integer_kind);
 
+  if (source->rank == -1)
+    return NULL;
+
   result = gfc_get_array_expr (BT_INTEGER, k, &source->where);
 
   if (source->rank == 0)