OSDN Git Service

2008-03-04 Uros Bizjak <ubizjak@gmail.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / list_read_4.f90
1 ! { dg-do run }
2 ! Test of gfortran list directed read> check delimiters are correctly
3 ! treated.  Written in f77 so that g77 will run for comparison.
4 !
5 ! f , e and i edit reads are terminated separately by read_real.c
6 !
7 ! PThomas                                                   Jan 2005
8 ! BDavis        
9       program list_read_4
10       integer i(10),l(10),k,j 
11       real x(10),y(10)
12 ! expected results
13       data y / 1.0,2.0,3.0,-1.0,-1.0,-1.0,4.0,4.0,99.0,99.0 /
14       data l /1,2,3,-1,-1,-1,4,4,99,99/
15 ! put them in a file
16       open (10,status="scratch")
17       write (10,*) " 1.0, 2.0 , 3.0,, 2* , 2*4.0 , 5*99.0"
18       write (10,*) " 1.0e0, 2.0e0 , 3.0e0,, 2* , 2*4.0e0 , 5*99.0e0"
19       write (10,*) " 1,   2 ,   3,,   2* , 2*4 ,   5*99"
20       write (10,*) " 1,   2 ,   3,,   2* , 2*4 ,   5*99"
21       rewind (10)
22 !
23       do k = 1,10
24         x(k) = -1.0
25       enddo
26       read (10,*,iostat=ier) x
27       if (ier.ne.0) call abort
28       do k = 1,10
29          if (x(k).ne.y(k)) call abort
30          x(k) = -1
31       end do
32       READ(10,*,iostat=ier) x
33       if (ier.ne.0) call abort
34       do k = 1,10
35          if (x(k).ne.y(k)) call abort
36          x(k) = -1
37       end do
38       READ(10,*,iostat=ier) x
39       if (ier.ne.0) call abort
40       do k = 1,10
41          if (x(k).ne.y(k)) call abort
42          x(k) = -1
43       end do
44 ! integer
45       do k = 1,10
46         i(k) = -1
47       end do 
48       READ(10,*,iostat=ier) (i(j),j=1,10)
49       if (ier.ne.0) call abort
50       do k = 1,10
51          if (i(k).ne.y(k)) call abort
52          i(k) = -1
53       end do
54       end