expr.c (gfc_get_corank): Return 0 if input expression is not a coarray.

* expr.c (gfc_get_corank): Return 0 if input expression is not a
	coarray.

From-SVN: r179675
This commit is contained in:
Mikael Morin 2011-10-07 21:14:07 +02:00 committed by Mikael Morin
parent bb033c9adc
commit 89010691e4
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2011-10-07 Mikael Morin <mikael.morin@sfr.fr>
* expr.c (gfc_get_corank): Return 0 if input expression is not a
coarray.
2011-10-07 Mikael Morin <mikael.morin@sfr.fr>
* trans-array.c (gfc_conv_expr_descriptor): Simplify coarray

View File

@ -4301,13 +4301,19 @@ gfc_get_corank (gfc_expr *e)
{
int corank;
gfc_ref *ref;
if (!gfc_is_coarray (e))
return 0;
corank = e->symtree->n.sym->as ? e->symtree->n.sym->as->corank : 0;
for (ref = e->ref; ref; ref = ref->next)
{
if (ref->type == REF_ARRAY)
corank = ref->u.ar.as->corank;
gcc_assert (ref->type != REF_SUBSTRING);
}
return corank;
}