iresolve.c (resolve_bound, [...]): Don't set the shape for assumed rank arrays.

* 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
This commit is contained in:
Mikael Morin 2012-08-02 19:10:38 +00:00
parent 742b0bcd66
commit d357d99113
3 changed files with 22 additions and 5 deletions

View 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.

View 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);
}

View 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)