]> gcc.gnu.org Git - gcc.git/commitdiff
expr.c (gfc_get_corank): Return 0 if input expression is not a coarray.
authorMikael Morin <mikael.morin@sfr.fr>
Fri, 7 Oct 2011 19:14:07 +0000 (21:14 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Fri, 7 Oct 2011 19:14:07 +0000 (19:14 +0000)
* expr.c (gfc_get_corank): Return 0 if input expression is not a
coarray.

From-SVN: r179675

gcc/fortran/ChangeLog
gcc/fortran/expr.c

index 9133321d59be9a4bbe55a59e8eb82b49577c2bdf..4263f19f915e97551f88388f8147612aa0d502a1 100644 (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
index 813a99d037b836b9176496f78e8b9eba14dafb74..397dcdc470fe5338e306a3c42af8b02b29d1bb15 100644 (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;
 }
 
This page took 0.078041 seconds and 5 git commands to generate.