summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/coarray_11.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/coarray_11.f90
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/coarray_11.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_11.f9064
1 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/coarray_11.f90 b/gcc/testsuite/gfortran.dg/coarray_11.f90
new file mode 100644
index 000000000..7ec735357
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_11.f90
@@ -0,0 +1,64 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single -fdump-tree-original" }
+!
+! PR fortran/18918
+! PR fortran/43919 for boundsTest()
+!
+! Coarray intrinsics
+!
+
+subroutine image_idx_test1()
+ INTEGER,save :: array[2,-1:4,8,*]
+ WRITE (*,*) IMAGE_INDEX (array, [2,0,3,1])
+ if (IMAGE_INDEX (array, [1,-1,1,1]) /= 1) call not_existing()
+ if (IMAGE_INDEX (array, [2,-1,1,1]) /= 0) call not_existing()
+ if (IMAGE_INDEX (array, [1,-1,1,2]) /= 0) call not_existing()
+end subroutine
+
+subroutine this_image_check()
+ integer,save :: a(1,2,3,5)[0:3,*]
+ integer :: j
+ if (this_image() /= 1) call not_existing()
+ if (this_image(a,dim=1) /= 0) call not_existing()
+ if (this_image(a,dim=2) /= 1) call not_existing()
+end subroutine this_image_check
+
+subroutine othercheck()
+real,save :: a(5)[2,*]
+complex,save :: c[4:5,6,9:*]
+integer,save :: i, j[*]
+dimension :: b(3)
+codimension :: b[5:*]
+dimension :: h(9:10)
+codimension :: h[8:*]
+save :: b,h
+if (this_image() /= 1) call not_existing()
+if (num_images() /= 1) call not_existing()
+if(any(this_image(coarray=a) /= [ 1, 1 ])) call not_existing()
+if(any(this_image(c) /= [4,1,9])) call not_existing()
+if(this_image(c, dim=3) /= 9) call not_existing()
+if(ubound(b,dim=1) /= 3 .or. this_image(coarray=b,dim=1) /= 5) call not_existing()
+if(ubound(h,dim=1) /= 10 .or. this_image(h,dim=1) /= 8) call not_existing()
+end subroutine othercheck
+
+subroutine andanother()
+integer,save :: a(1)[2:9,4,-3:5,0:*]
+print *, lcobound(a)
+print *, lcobound(a,dim=3,kind=8)
+print *, ucobound(a)
+print *, ucobound(a,dim=1,kind=2)
+if (any(lcobound(a) /= [2, 1, -3, 0])) call not_existing()
+if (any(ucobound(a) /= [9, 4, 5, 0])) call not_existing()
+if (lcobound(a,dim=3,kind=8) /= -3_8) call not_existing()
+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" } }