aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorMikael Morin <mikael.morin@sfr.fr>2011-10-07 21:14:07 +0200
committerMikael Morin <mikael@gcc.gnu.org>2011-10-07 19:14:07 +0000
commit89010691e4bf2461727c91d7cfc306feed998577 (patch)
tree75aee0770bc00825b7415fe469796ebed7dbc3bd /gcc/fortran/expr.c
parentbb033c9adcbca5fb3dc60566e879e85d5190d696 (diff)
downloadgcc-89010691e4bf2461727c91d7cfc306feed998577.zip
gcc-89010691e4bf2461727c91d7cfc306feed998577.tar.gz
gcc-89010691e4bf2461727c91d7cfc306feed998577.tar.bz2
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
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 813a99d..397dcdc 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -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;
}