2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / fmt_t_9.f
blobbfe0361d0e12aab0688168acd7ff251222b67737
1 ! { dg-options "-ffixed-line-length-none -std=gnu" }
2 ! { dg-do run }
3 ! PR78123 Short reads with T edit descriptor not padding correctly
4 PROGRAM tformat
6 INTEGER MXFLTL
7 PARAMETER (MXFLTL = 99999)
8 INTEGER IFLGHT, NFLCYC, IFLTSQ(MXFLTL), IDXBLK, LMAX, LMIN, I
10 OPEN(29, status='scratch')
11 WRITE(29, '(a)') " 1 1 1 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 72 122 4"
12 WRITE(29, '(a)') ""
13 WRITE(29, '(a)') " 451 402012011201120112011200120112011201120112011201120111971201120112011201120112011201"
14 WRITE(29, '(a)') " 451 4020 866 866 866 866 866 866 866 866 865 866 865 866 866 866 866 866 866 866 865 866"
15 REWIND(29)
16 C The error occurs in the following loop:
17 10 CONTINUE
18 READ(29,1010 ) IDXBLK, LMAX, LMIN
19 1010 FORMAT(8X,I4,T51,2I5) ! wrong if this format is used
20 c write(6,fmt='("IDXBLK,LMAX,LMIN=",3I5)')IDXBLK,LMAX,LMIN
21 IF (IDXBLK .EQ. 0) GO TO 20
22 GO TO 10
24 20 CONTINUE
25 READ(29,1040,END=100) IFLGHT, NFLCYC,
26 & (IFLTSQ(I), I=1,NFLCYC)
27 1040 FORMAT(I5,I5,2X,(T13,20I4))
28 c write(6,fmt='(2i6)') IFLGHT,NFLCYC
29 c write(6,fmt='(20I4)') (IFLTSQ(I), I=1,NFLCYC)
30 c write(6,*) "Program is correct"
31 close(29)
32 if (IFLGHT.ne.451) call abort
33 if (NFLCYC.ne.40) call abort
34 stop
36 100 CONTINUE
37 C write(6,*) "End of file encountered (wrong)"
38 close (29)
39 call abort
40 STOP
41 END