PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / arrayio_1.f90
blobb5b583162ba5cb93acb8c5875c424e248c5b43bb
1 ! { dg-do run }
2 ! PR 21875 : Test formatted input/output to/from character arrays.
3 ! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
4 program arrayio_1
5 implicit none
6 integer :: i(6),j,k
7 character(12) :: r(12,2) = '0123456789AB'
9 ! Write to and read from a whole character array
11 i = (/(j,j=1,6)/)
12 write(r,'(3(2x,i4/)/3(3x,i6/))') i
13 i = 0
14 read(r,'(3(2x,i4/)/3(3x,i6/))') i
15 if (any(i.ne.(/(j,j=1,6)/))) STOP 1
16 do j=1,12
17 do k=1,2
18 if ((j.gt.8.and.k.eq.1).or.(k.eq.2)) then
19 if (r(j,k).ne.'0123456789AB') STOP 2
20 end if
21 end do
22 end do
24 ! Write to a portion of a character array
25 r = '0123456789AB'
26 write(r(3:9,1),'(6(i12/))') i
27 if (r(2,1).ne.'0123456789AB') STOP 3
28 do j=3,8
29 if (iachar(trim(adjustl(r(j,1))))-46.ne.j) STOP 4
30 end do
31 if (r(9,1).ne.' ') STOP 5
32 end program arrayio_1