Commit d357d991 by Mikael Morin

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
parent 742b0bcd
2012-08-02 Mikael Morin <mikael@gcc.gnu.org> 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. * array.c (gfc_copy_array_ref): Don't copy the offset field.
* expr.c (find_array_section): Ignore the offset field. * expr.c (find_array_section): Ignore the offset field.
* trans-expr.c (gfc_find_interface_mapping_to_ref): Don't apply * trans-expr.c (gfc_find_interface_mapping_to_ref): Don't apply
......
...@@ -134,10 +134,13 @@ resolve_bound (gfc_expr *f, gfc_expr *array, gfc_expr *dim, gfc_expr *kind, ...@@ -134,10 +134,13 @@ resolve_bound (gfc_expr *f, gfc_expr *array, gfc_expr *dim, gfc_expr *kind,
if (dim == NULL) if (dim == NULL)
{ {
f->rank = 1; f->rank = 1;
if (array->rank != -1)
{
f->shape = gfc_get_shape (1); f->shape = gfc_get_shape (1);
mpz_init_set_ui (f->shape[0], coarray ? gfc_get_corank (array) mpz_init_set_ui (f->shape[0], coarray ? gfc_get_corank (array)
: array->rank); : array->rank);
} }
}
f->value.function.name = xstrdup (name); f->value.function.name = xstrdup (name);
} }
...@@ -2225,8 +2228,12 @@ gfc_resolve_shape (gfc_expr *f, gfc_expr *array, gfc_expr *kind) ...@@ -2225,8 +2228,12 @@ gfc_resolve_shape (gfc_expr *f, gfc_expr *array, gfc_expr *kind)
f->ts.kind = gfc_default_integer_kind; f->ts.kind = gfc_default_integer_kind;
f->rank = 1; f->rank = 1;
if (array->rank != -1)
{
f->shape = gfc_get_shape (1); f->shape = gfc_get_shape (1);
mpz_init_set_ui (f->shape[0], array->rank); mpz_init_set_ui (f->shape[0], array->rank);
}
f->value.function.name = gfc_get_string (PREFIX ("shape_%d"), f->ts.kind); f->value.function.name = gfc_get_string (PREFIX ("shape_%d"), f->ts.kind);
} }
......
...@@ -5470,6 +5470,9 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind) ...@@ -5470,6 +5470,9 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind)
gfc_try t; gfc_try t;
int k = get_kind (BT_INTEGER, kind, "SHAPE", gfc_default_integer_kind); 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); result = gfc_get_array_expr (BT_INTEGER, k, &source->where);
if (source->rank == 0) if (source->rank == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment