2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / arrayio_2.f90
blob00b96bf41c65f6400342e58fabf55c209b7baf98
1 ! { dg-do run }
2 ! PR 21875 : Test formatted input/output to/from character arrays.
3 ! This test ckecks proper positioning and padding with trailing blanks
4 ! after write operations. Contributed by Paul Thomas.
5 program arrayio_2
6 implicit none
7 integer :: i=2
8 character(len=12), dimension(4,2) :: r = "0123456789ab"
9 character(len=80) :: f
11 f = '("hello"/"world")'
13 write(r(1:4,i-1), f)
15 f = '("hello",t1,"HELLO",1x,"!"/"world",tl12,"WORLD")'
17 write(r((i-1):(i+1),i), f)
19 if ( r(1,1).ne.'hello ' .or. &
20 r(2,1).ne.'world ' .or. &
21 r(3,1).ne.'0123456789ab' .or. &
22 r(4,1).ne.'0123456789ab' .or. &
23 r(1,2).ne.'HELLO ! ' .or. &
24 r(2,2).ne.'WORLD ' .or. &
25 r(3,2).ne.'0123456789ab' .or. &
26 r(4,2).ne.'0123456789ab') call abort()
28 end program arrayio_2