[Bug fortran/46370] [Coarray] [OOP] ALLOCATE: Error allocating CLASS coarrays

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 10 15:11:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46370

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-10 15:10:48 UTC ---
(In reply to comment #0)

> allocate (t :: a[*])

That's what I wanted to post; not the following:
> allocate (t :: a)

(which is invalid but properly rejected).

The first error is fixed by the following patch. It then stops when checking
the constraints C617 and C1229 in "resolve_procedure:" of resolve_variable.
("Polymorphic subobject of coindexed object" -- the message is bogus: There is
no subobject - coindexed or not; seemingly, probably the _data component is
picked up.)

BTW: In the patch below, one needs to check whether something similar is needed
at more places in that function.

--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1785,3 +1785,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag,
bool sub_flag,
       m = gfc_match_array_ref (&tail->u.ar, equiv_flag ? NULL : sym->as,
-                              equiv_flag, sym->as ? sym->as->corank : 0);
+                              equiv_flag,
+                              sym->ts.type == BT_CLASS
+                              ? CLASS_DATA (sym)->as
+                                ? CLASS_DATA (sym)->as->corank : 0
+                              : sym->as ? sym->as->corank : 0);
       if (m != MATCH_YES)



More information about the Gcc-bugs mailing list