PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_11.f
blob4b37470e2bb117f03c5fc58c0d2f659c7f45e255
1 c { dg-do run { target fd_truncate } }
2 c This program tests: namelist comment, a blank line before the nameilist name, the namelist name,
3 c a scalar qualifier, various combinations of space, comma and lf delimiters, f-formats, e-formats
4 c a blank line within the data read, nulls, a range qualifier, a new object name before end of data
5 c and an integer read. It also tests that namelist output can be re-read by namelist input.
6 c provided by Paul Thomas - pault@gcc.gnu.org
8 program namelist_1
10 REAL x(10)
11 REAL(kind=8) xx
12 integer ier
13 namelist /mynml/ x, xx
15 do i = 1 , 10
16 x(i) = -1
17 end do
18 x(6) = 6.0
19 x(10) = 10.0
20 xx = 0d0
22 open (10,status="scratch")
23 write (10, *) "!mynml"
24 write (10, *) ""
25 write (10, *) "&gf /"
26 write (10, *) "&mynml x(7) =+99.0e0 x=1.0, 2.0 ,"
27 write (10, *) " 2*3.0, ,, 7.0e0,+0.08e+02 !comment"
28 write (10, *) ""
29 write (10, *) " 9000e-3 x(4:5)=4 ,5 "
30 write (10, *) " x=,,3.0, xx=10d0 /"
31 rewind (10)
33 read (10, nml=mynml, IOSTAT=ier)
34 if (ier.ne.0) STOP 1
35 rewind (10)
37 do i = 1 , 10
38 if ( abs( x(i) - real(i) ) .gt. 1e-8 ) STOP 2
39 end do
40 if ( abs( xx - 10d0 ) .gt. 1e-8 ) STOP 3
42 write (10, nml=mynml, iostat=ier)
43 if (ier.ne.0) STOP 4
44 rewind (10)
46 read (10, NML=mynml, IOSTAT=ier)
47 if (ier.ne.0) STOP 5
48 close (10)
50 do i = 1 , 10
51 if ( abs( x(i) - real(i) ) .gt. 1e-8 ) STOP 6
52 end do
53 if ( abs( xx - 10d0 ) .gt. 1e-8 ) STOP 7
55 end program