diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-04-06 20:23:56 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-04-06 20:23:56 +0200 |
commit | 178f9aa17efb04fe73f447763c9cab64166b1041 (patch) | |
tree | 09851507edcb4905b8c3426e51a826c7aa3fb49c /gcc/fortran/resolve.c | |
parent | d079b87fab5e8de93c897940b750286d31d5d003 (diff) | |
download | gcc-178f9aa17efb04fe73f447763c9cab64166b1041.zip gcc-178f9aa17efb04fe73f447763c9cab64166b1041.tar.gz gcc-178f9aa17efb04fe73f447763c9cab64166b1041.tar.bz2 |
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2010-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* gfortran.h (gfc_array_spec): Add cotype.
* array.c (gfc_match_array_spec,gfc_set_array_spec): Use it
and defer error diagnostic.
* resolve.c (resolve_fl_derived): Add missing check.
(resolve_symbol): Add cotype/type check.
* parse.c (parse_derived): Fix setting of coarray_comp.
2010-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* gfortran.dg/coarray_4.f90: Fix test.
* gfortran.dg/coarray_6.f90: Add more tests.
From-SVN: r158014
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 55c0d12..3ec454e 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -10481,7 +10481,8 @@ resolve_fl_derived (gfc_symbol *sym) /* F2008, C444. */ if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.coarray_comp - && (c->attr.codimension || c->attr.pointer || c->attr.dimension)) + && (c->attr.codimension || c->attr.pointer || c->attr.dimension + || c->attr.allocatable)) { gfc_error ("Component '%s' at %L with coarray component " "shall be a nonpointer, nonallocatable scalar", @@ -11319,11 +11320,6 @@ resolve_symbol (gfc_symbol *sym) } } - if (sym->attr.codimension && sym->attr.allocatable - && sym->as->type != AS_DEFERRED) - gfc_error ("Allocatable coarray variable '%s' at %L must have " - "deferred shape", sym->name, &sym->declared_at); - /* F2008, C526. */ if (((sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.coarray_comp) || sym->attr.codimension) @@ -11355,6 +11351,16 @@ resolve_symbol (gfc_symbol *sym) gfc_error ("Variable '%s' at %L is a coarray or has a coarray " "component and is not ALLOCATABLE, SAVE nor a " "dummy argument", sym->name, &sym->declared_at); + /* F2008, C528. */ + else if (sym->attr.codimension && !sym->attr.allocatable + && sym->as->cotype == AS_DEFERRED) + gfc_error ("Coarray variable '%s' at %L shall not have codimensions with " + "deferred shape", sym->name, &sym->declared_at); + else if (sym->attr.codimension && sym->attr.allocatable + && (sym->as->type != AS_DEFERRED || sym->as->cotype != AS_DEFERRED)) + gfc_error ("Allocatable coarray variable '%s' at %L must have " + "deferred shape", sym->name, &sym->declared_at); + /* F2008, C541. */ if (((sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.coarray_comp) |