| 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 |
| 10 |
|
| 11 |
f = '("hello"/"world")' |
| 12 |
|
| 13 |
write(r(1:4,i-1), f) |
| 14 |
|
| 15 |
f = '("hello",t1,"HELLO",1x,"!"/"world",tl12,"WORLD")' |
| 16 |
|
| 17 |
write(r((i-1):(i+1),i), f) |
| 18 |
|
| 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') STOP 1 |
| 27 |
|
| 28 |
end program arrayio_2 |