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