2 ! { dg-options "-fcoarray=single -Wzerotrip" }
6 ! Contributed by John Reid.
10 real, allocatable
:: z(:)[:]
12 character(len
=128) :: str
15 write(*,*) 'z allocated on image',this_image()
17 if (this_image()==1) then
19 do image
= 2, num_images() ! { dg-warning "will be executed zero times" }
20 write(*,*) 'Assigning z(:) on image',image
26 str
= repeat('X', len(str
))
27 write(str
,*) 'z=',z(:),' on image',this_image()
28 if (str
/= " z= 1.20000005 1.20000005 1.20000005 on image 1") &
31 str
= repeat('X', len(str
))
32 write(str
,*) 'z=',z
,' on image',this_image()
33 if (str
/= " z= 1.20000005 1.20000005 1.20000005 on image 1") &
36 str
= repeat('X', len(str
))
37 write(str
,*) 'z=',z(1:3)[this_image()],' on image',this_image()
38 if (str
/= " z= 1.20000005 1.20000005 1.20000005 on image 1") &
47 real, allocatable
:: z(:,:)[:,:]
49 character(len
=128) :: str
52 write(*,*) 'z allocated on image',this_image()
54 if (this_image()==1) then
56 do image
= 2, num_images() ! { dg-warning "will be executed zero times" }
57 write(*,*) 'Assigning z(:) on image',image
63 str
= repeat('X', len(str
))
64 write(str
,*) 'z=',z(:,:),' on image',this_image()
65 if (str
/= " z= 1.20000005 1.20000005 1.20000005 1.20000005 on image 1") &
68 str
= repeat('X', len(str
))
69 write(str
,*) 'z=',z
,' on image',this_image()
70 if (str
/= " z= 1.20000005 1.20000005 1.20000005 1.20000005 on image 1") &
78 character(len
=128) :: str
83 str
= repeat('X', len(str
))
84 write(str
,*) 'In main on image',this_image(), 'w= ',w
85 if (str
/= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") &
88 str
= repeat('X', len(str
))
89 write(str
,*) 'In main on image',this_image(), 'w= ',w(1:4)
90 if (str
/= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") &
93 str
= repeat('X', len(str
))
94 write(str
,*) 'In main on image',this_image(), 'w= ',w(:)[1]
95 if (str
/= " In main on image 1 w= 1.00000000 1.00000000 1.00000000 1.00000000") &
102 subroutine ex5_sub(n
,w
)
106 character(len
=75) :: str
108 str
= repeat('X', len(str
))
109 write(str
,*) 'In sub on image',this_image(), 'w= ',w
110 if (str
/= " In sub on image 1 w= 1.00000000") &
112 end subroutine ex5_sub