This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch,Fortran] PR43919 - coarray 10/n: Fix (u,l)cobounds for coarray scalars
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 28 Apr 2010 20:18:58 +0200
- Subject: [Patch,Fortran] PR43919 - coarray 10/n: Fix (u,l)cobounds for coarray scalars
(u,l)cobounds gave an ICE for scalar coarrays as they end up with
ar.type == AR_ELEMENT, which was not handled. The fix is straight forward.
Build and currently regtesting on x86-64-linux. If successful, OK for
the trunk?
Tobias
2010-04-28 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
PR fortran/43919
* simplify.c (simplify_cobound): Handle scalar coarrays.
2010-04-28 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
PR fortran/43919
* gfortran.dg/coarray_11.f90: Add scalar-coarrays test case.
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 158822)
+++ gcc/fortran/simplify.c (working copy)
@@ -2936,6 +2936,13 @@ simplify_cobound (gfc_expr *array, gfc_e
switch (ref->u.ar.type)
{
case AR_ELEMENT:
+ if (ref->next == NULL)
+ {
+ gcc_assert (ref->u.ar.as->corank > 0
+ && ref->u.ar.as->rank == 0);
+ as = ref->u.ar.as;
+ goto done;
+ }
as = NULL;
continue;
Index: gcc/testsuite/gfortran.dg/coarray_11.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_11.f90 (revision 158822)
+++ gcc/testsuite/gfortran.dg/coarray_11.f90 (working copy)
@@ -2,6 +2,7 @@
! { dg-options "-fcoarray=single -fdump-tree-original" }
!
! PR fortran/18918
+! PR fortran/43919 for boundsTest()
!
! Coarray intrinsics
!
@@ -52,5 +53,12 @@ if (lcobound(a,dim=3,kind=8) /= -3_8) c
if (ucobound(a,dim=1,kind=2) /= 9_2) call not_existing()
end subroutine andanother
+subroutine boundsTest()
+ implicit none
+ integer :: a[*] = 7
+ if (any (lcobound(a) /= [1])) call not_existing()
+ if (any (ucobound(a) /= [1])) call not_existing()
+end subroutine boundsTest
+
! { dg-final { scan-tree-dump-times "not_existing" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }