re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])

2011-04-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * module.c (mio_array_spec): Set as->cotype on reading.
        * resolve.c (resolve_allocate_expr): Fix allocating coarray
        components.

2011-04-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.dg/coarray_19.f90: New.

From-SVN: r172897
This commit is contained in:
Tobias Burnus 2011-04-23 12:26:38 +02:00 committed by Tobias Burnus
parent 16997bc011
commit c49eaa233a
5 changed files with 58 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2011-04-23 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* module.c (mio_array_spec): Set as->cotype on reading.
* resolve.c (resolve_allocate_expr): Fix allocating coarray
components.
2011-04-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48405

View File

@ -2203,6 +2203,9 @@ mio_array_spec (gfc_array_spec **asp)
mio_integer (&as->corank);
as->type = MIO_NAME (array_type) (as->type, array_spec_types);
if (iomode == IO_INPUT && as->corank)
as->cotype = (as->type == AS_DEFERRED) ? AS_DEFERRED : AS_EXPLICIT;
for (i = 0; i < as->rank + as->corank; i++)
{
mio_expr (&as->lower[i]);

View File

@ -6636,6 +6636,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
{
int i, pointer, allocatable, dimension, is_abstract;
int codimension;
bool coindexed;
symbol_attribute attr;
gfc_ref *ref, *ref2;
gfc_expr *e2;
@ -6693,18 +6694,32 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
codimension = sym->attr.codimension;
}
coindexed = false;
for (ref = e->ref; ref; ref2 = ref, ref = ref->next)
{
switch (ref->type)
{
case REF_ARRAY:
if (ref->u.ar.codimen > 0)
{
int n;
for (n = ref->u.ar.dimen;
n < ref->u.ar.dimen + ref->u.ar.codimen; n++)
if (ref->u.ar.dimen_type[n] != DIMEN_THIS_IMAGE)
{
coindexed = true;
break;
}
}
if (ref->next != NULL)
pointer = 0;
break;
case REF_COMPONENT:
/* F2008, C644. */
if (gfc_is_coindexed (e))
if (coindexed)
{
gfc_error ("Coindexed allocatable object at %L",
&e->where);

View File

@ -1,3 +1,8 @@
2011-04-23 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* gfortran.dg/coarray_19.f90: New.
2011-04-23 Jakub Jelinek <jakub@redhat.com>
PR c/48685

View File

@ -0,0 +1,27 @@
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/18918
!
! Was failing before as the "x%a()[]" was
! regarded as coindexed
subroutine test2()
type t
integer, allocatable :: a(:)[:]
end type t
type(t), SAVE :: x
allocate(x%a(1)[*])
end subroutine test2
module m
integer, allocatable :: a(:)[:]
end module m
! Was failing as "a" was allocatable but
! as->cotype was not AS_DEFERERED.
use m
end
! { dg-final { cleanup-modules "m" } }