2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_bad_advance.f90
blob3ca4493c451fe0ce129282c378a2f7b0456cdf04
1 ! { dg-do run { target fd_truncate } }
2 ! PR27138 Failure to advance line on bad list directed read.
3 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 program test
5 implicit none
6 integer :: ntype = 55
7 real :: rtype
8 complex :: ctype
9 logical :: ltype
10 OPEN (10)
11 write(10,*) "aaaa aaaa aaaa aaaa"
12 write(10,*) "bbbb bbbb bbbb bbbb"
13 write(10,*) "cccc cccc cccc cccc"
14 write(10,*) "dddd dddd dddd dddd"
15 write(10,*) " "
16 write(10,*) "1234 5678 9012 3456"
17 rewind(10)
18 READ (10,*,END=77,ERR=77) ntype
19 goto 99
20 77 READ (10,*,END=78,ERR=78) rtype
21 goto 99
22 78 READ (10,*,END=79,ERR=79) ctype
23 goto 99
24 79 READ (10,*,END=80,ERR=80) ltype
25 goto 99
26 80 READ (10,*,END=99,ERR=99) ntype
27 if (ntype.ne.1234) goto 99
28 close(10, status="delete")
29 stop
30 99 close(10, status="delete")
31 call abort()
32 end program test