2 ! { dg-options "-fcoarray=single -fdump-tree-original" }
5 ! PR fortran/43919 for boundsTest()
10 subroutine image_idx_test1()
11 INTEGER,save :: array
[2,-1:4,8,*]
12 WRITE (*,*) IMAGE_INDEX (array
, [2,0,3,1])
13 if (IMAGE_INDEX (array
, [1,-1,1,1]) /= 1) call not_existing()
14 if (IMAGE_INDEX (array
, [2,-1,1,1]) /= 0) call not_existing()
15 if (IMAGE_INDEX (array
, [1,-1,1,2]) /= 0) call not_existing()
18 subroutine this_image_check()
19 integer,save :: a(1,2,3,5)[0:3,*]
21 if (this_image() /= 1) call not_existing()
22 if (this_image(a
,dim
=1) /= 0) call not_existing()
23 if (this_image(a
,dim
=2) /= 1) call not_existing()
24 end subroutine this_image_check
26 subroutine othercheck()
27 real,save :: a(5)[2,*]
28 complex,save :: c
[4:5,6,9:*]
29 integer,save :: i
, j
[*]
35 if (this_image() /= 1) call not_existing()
36 if (num_images() /= 1) call not_existing()
37 if(any(this_image(coarray
=a
) /= [ 1, 1 ])) call not_existing()
38 if(any(this_image(c
) /= [4,1,9])) call not_existing()
39 if(this_image(c
, dim
=3) /= 9) call not_existing()
40 if(ubound(b
,dim
=1) /= 3 .or
. this_image(coarray
=b
,dim
=1) /= 5) call not_existing()
41 if(ubound(h
,dim
=1) /= 10 .or
. this_image(h
,dim
=1) /= 8) call not_existing()
42 end subroutine othercheck
44 subroutine andanother()
45 integer,save :: a(1)[2:9,4,-3:5,0:*]
47 print *, lcobound(a
,dim
=3,kind
=8)
49 print *, ucobound(a
,dim
=1,kind
=2)
50 if (any(lcobound(a
) /= [2, 1, -3, 0])) call not_existing()
51 if (any(ucobound(a
) /= [9, 4, 5, 0])) call not_existing()
52 if (lcobound(a
,dim
=3,kind
=8) /= -3_8) call not_existing()
53 if (ucobound(a
,dim
=1,kind
=2) /= 9_2) call not_existing()
54 end subroutine andanother
56 subroutine boundsTest()
59 if (any (lcobound(a
) /= [1])) call not_existing()
60 if (any (ucobound(a
) /= [1])) call not_existing()
61 end subroutine boundsTest
63 ! { dg-final { scan-tree-dump-times "not_existing" 0 "original" } }
64 ! { dg-final { cleanup-tree-dump "original" } }