2008-07-06 Kai Tietz <kai.tietz@onevision.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_37.f90
blobe200ad0b364710985d2217b28b73af5a806492ca
1 ! { dg-do run { target fd_truncate } }
2 ! PR33039 Read NAMELIST: reads wrong namelist name
3 ! Test case from PR modified by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 PROGRAM namelist
5 CHARACTER*25 CHAR
6 NAMELIST /CODE/ CHAR, X
7 NAMELIST /CODEtwo/ X
9 OPEN(10, status="scratch")
10 write(10,'(a)') "File with test NAMELIST inputs"
11 write(10,'(a)') " &CODVJS char='VJS-Not a proper nml name', X=-0.5/"
12 write(10,'(a)') " &CODEone char='CODEone input', X=-1.0 /"
13 write(10,'(a)') " &CODEtwo char='CODEtwo inputs', X=-2.0/"
14 write(10,'(a)') " &code char='Lower case name',X=-3.0/"
15 write(10,'(a)') " &CODE char='Desired namelist sel', X=44./"
16 write(10,'(a)') " &CODEx char='Should not read CODEx nml', X=-5./"
17 write(10,'(a)') " $CODE char='Second desired nml', X=66.0 /"
18 write(10,'(a)') " $CODE X=77.0, char='Reordered desired nml'/"
19 rewind(10)
20 CHAR = 'Initialize string ***'
21 X = -777.
22 READ(10, nml=CODE, END=999)
23 if (x.ne.-3.0) call abort
24 READ(10, nml=CODE, END=999)
25 if (x.ne.44.0) call abort
26 READ(10, nml=CODE, END=999)
27 if (x.ne.66.0) call abort
28 READ(10, nml=CODE, END=999)
29 999 if (x.ne.77.0) call abort
30 END PROGRAM namelist