2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr59700.f90
blob15bf26129ab07e9f583bb78687252096ac4341a9
1 ! { dg-do run }
2 ! PR59700 Test case by Steve Kargl
3 program foo
5 implicit none
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
14 open(unit=fd, status='scratch')
15 write(fd, '(A)') '1 2 3.4 q'
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') call abort
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') call abort
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') call abort
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') 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
38 40 if (msg /= 'Bad complex floating point number for item 2') call abort
39 close(fd)
40 end program foo