From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gfortran.dg/coarray_6.f90 | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/coarray_6.f90 (limited to 'gcc/testsuite/gfortran.dg/coarray_6.f90') diff --git a/gcc/testsuite/gfortran.dg/coarray_6.f90 b/gcc/testsuite/gfortran.dg/coarray_6.f90 new file mode 100644 index 000000000..d3c600b36 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_6.f90 @@ -0,0 +1,85 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! Coarray support -- corank declarations +! PR fortran/18918 +! +module m2 + use iso_c_binding + integer(c_int), bind(C) :: a[*] ! { dg-error "BIND.C. attribute conflicts with CODIMENSION" } + + type, bind(C) :: t ! { dg-error "cannot have the ALLOCATABLE" } + integer(c_int), allocatable :: a[:] ! { dg-error "cannot have the ALLOCATABLE" } + integer(c_int) :: b[*] ! { dg-error "must be allocatable" } + end type t +end module m2 + +subroutine bind(a) bind(C) ! { dg-error "Coarray dummy variable" } + use iso_c_binding + integer(c_int) :: a[*] +end subroutine bind + +subroutine allo(x) ! { dg-error "can thus not be an allocatable coarray" } + integer, allocatable, intent(out) :: x[:] +end subroutine allo + +module m + integer :: modvar[*] ! OK, implicit save + type t + complex, allocatable :: b(:,:,:,:)[:,:,:] + end type t +end module m + +subroutine bar() + integer, parameter :: a[*] = 4 ! { dg-error "PARAMETER attribute conflicts with CODIMENSION" } + integer, pointer :: b[:] ! { dg-error "is not ALLOCATABLE, SAVE nor a dummy" } +end subroutine bar + +subroutine vol() + integer,save :: a[*] + block + volatile :: a ! { dg-error "Specifying VOLATILE for coarray" } + end block +contains + subroutine int() + volatile :: a ! { dg-error "Specifying VOLATILE for coarray" } + end subroutine int +end subroutine vol + + +function func() result(func2) ! { dg-error "shall not be a coarray or have a coarray component" } + use m + type(t) :: func2 +end function func + +subroutine invalid() + type t + integer, allocatable :: a[:] + end type t + type t2 + type(t), allocatable :: b ! { dg-error "nonpointer, nonallocatable scalar" } + end type t2 + type t3 + type(t), pointer :: c ! { dg-error "nonpointer, nonallocatable scalar" } + end type t3 + type t4 + type(t) :: d(4) ! { dg-error "nonpointer, nonallocatable scalar" } + end type t4 +end subroutine invalid + +subroutine valid(a) + integer :: a(:)[4,-1:6,4:*] + type t + integer, allocatable :: a[:] + end type t + type t2 + type(t) :: b + end type t2 + type(t2), save :: xt2[*] +end subroutine valid + +program main + integer :: A[*] ! Valid, implicit SAVE attribute +end program main + +! { dg-final { cleanup-modules "m" } } -- cgit v1.2.3