| 1 |
! { dg-do run } |
| 2 |
! PR 24862: IO for arrays of derived type handled incorrectly. |
| 3 |
program arrayio_derived_1 |
| 4 |
implicit none |
| 5 |
type tp |
| 6 |
integer :: i |
| 7 |
character(len=1) :: c |
| 8 |
end type tp |
| 9 |
type(tp) :: x(5) |
| 10 |
character(len=500) :: a |
| 11 |
integer :: i, b(5) |
| 12 |
|
| 13 |
x%i = 256 |
| 14 |
x%c = "q" |
| 15 |
|
| 16 |
write(a, *) x%i |
| 17 |
read(a, *) b |
| 18 |
do i = 1, 5 |
| 19 |
if (b(i) /= 256) then |
| 20 |
STOP 1 |
| 21 |
end if |
| 22 |
end do |
| 23 |
write(a, *) x ! Just test that the library doesn't abort. |
| 24 |
write(a, *) x(:)%i |
| 25 |
b = 0 |
| 26 |
read(a, *) b |
| 27 |
do i = 1, 5 |
| 28 |
if (b(i) /= 256) then |
| 29 |
STOP 2 |
| 30 |
end if |
| 31 |
end do |
| 32 |
|
| 33 |
end program arrayio_derived_1 |