| 1 |
! { dg-do run } |
| 2 |
! PR59700 Test case by Steve Kargl |
| 3 |
program foo |
| 4 |
|
| 5 |
implicit none |
| 6 |
|
| 7 |
character(len=80) msg |
| 8 |
integer, parameter :: fd = 10 |
| 9 |
integer i1, i2, i3, i4 |
| 10 |
real x1, x2, x3, x4 |
| 11 |
complex c1, c2 |
| 12 |
logical a |
| 13 |
|
| 14 |
open(unit=fd, status='scratch') |
| 15 |
write(fd, '(A)') '1 2 3.4 q' |
| 16 |
|
| 17 |
rewind(fd) |
| 18 |
msg = 'ok' |
| 19 |
read(fd, *, err=10, iomsg=msg) i1, i2, i3, i4 |
| 20 |
10 if (msg /= 'Bad integer for item 3 in list input') STOP 1 |
| 21 |
rewind(fd) |
| 22 |
msg = 'ok' |
| 23 |
read(fd, *, err=20, iomsg=msg) x1, x2, x3, x4 |
| 24 |
20 if (msg /= 'Bad real number in item 4 of list input') STOP 2 |
| 25 |
rewind(fd) |
| 26 |
msg = 'ok' |
| 27 |
read(fd, *, err=30, iomsg=msg) i1, x2, x1, a |
| 28 |
30 if (msg /= 'Bad logical value while reading item 4') STOP 3 |
| 29 |
rewind(fd) |
| 30 |
read(fd, *, err=31, iomsg=msg) i1, x2, a, x1 |
| 31 |
31 if (msg /= 'Bad repeat count in item 3 of list input') STOP 4 |
| 32 |
close(fd) |
| 33 |
open(unit=fd, status='scratch') |
| 34 |
write(fd, '(A)') '(1, 2) (3.4, q)' |
| 35 |
rewind(fd) |
| 36 |
msg = 'ok' |
| 37 |
read(fd, *, err=40, iomsg=msg) c1, c2 |
| 38 |
40 if (msg /= 'Bad complex floating point number for item 2') STOP 5 |
| 39 |
close(fd) |
| 40 |
end program foo |