1c { dg-do run { target fd_truncate } } 2c This program tests: namelist comment, a blank line before the nameilist name, the namelist name, 3c a scalar qualifier, various combinations of space, comma and lf delimiters, f-formats, e-formats 4c a blank line within the data read, nulls, a range qualifier, a new object name before end of data 5c and an integer read. It also tests that namelist output can be re-read by namelist input. 6c provided by Paul Thomas - pault@gcc.gnu.org 7 8 program namelist_1 9 10 REAL x(10) 11 REAL(kind=8) xx 12 integer ier 13 namelist /mynml/ x, xx 14 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 21 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) 32 33 read (10, nml=mynml, IOSTAT=ier) 34 if (ier.ne.0) call abort 35 rewind (10) 36 37 do i = 1 , 10 38 if ( abs( x(i) - real(i) ) .gt. 1e-8 ) call abort 39 end do 40 if ( abs( xx - 10d0 ) .gt. 1e-8 ) call abort 41 42 write (10, nml=mynml, iostat=ier) 43 if (ier.ne.0) call abort 44 rewind (10) 45 46 read (10, NML=mynml, IOSTAT=ier) 47 if (ier.ne.0) call abort 48 close (10) 49 50 do i = 1 , 10 51 if ( abs( x(i) - real(i) ) .gt. 1e-8 ) call abort 52 end do 53 if ( abs( xx - 10d0 ) .gt. 1e-8 ) call abort 54 55 end program 56