1! { dg-do run }
2! PR59700 Test case by Steve Kargl
3program 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
2010 if (msg /= 'Bad integer for item 3 in list input') call abort
21   rewind(fd)
22   msg = 'ok'
23   read(fd, *, err=20, iomsg=msg) x1, x2, x3, x4
2420 if (msg /= 'Bad real number in item 4 of list input') call abort
25   rewind(fd)
26   msg = 'ok'
27   read(fd, *, err=30, iomsg=msg) i1, x2, x1, a
2830 if (msg /= 'Bad logical value while reading item 4') call abort
29   rewind(fd)
30   read(fd, *, err=31, iomsg=msg) i1, x2, a, x1
3131 if (msg /= 'Bad repeat count in item 3 of list input') call abort
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
3840 if (msg /= 'Bad complex floating point number for item 2') call abort
39   close(fd)
40end program foo
41