OSDN Git Service

PR fortran/29713
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / pr17286.f90
1 ! { dg-do run }
2 ! PR17286
3 ! Namelist read failed when spaces exist between the '=' and the numbers
4 ! This is a libgfortran bug
5 ! Derived from testcase provided by Paul Thomas <paulthomas2@wanadoo.fr>
6        program bug3
7        integer num1 , num2 , num3 , num4 
8        data num3  / 42 /
9        data num4  / 56 /
10        namelist /mynml1/ num1,num2
11        namelist /mynml2/ num3,num4
12        logical dbg
13        data dbg / .FALSE. /
14        open(unit=10,status='SCRATCH')
15        write(10,'(A)') "&mynml1,num1= 16,num2=32,&end"
16 !
17 ! write mynml2
18 !
19        write(10,mynml2)
20        rewind(10)
21 !
22 ! now read back
23 !
24        num1 = -1
25        num2 = -1
26        read(10,mynml1)
27        if (num1.eq.16.and.num2.eq.32) then
28           if (dbg) write(*,mynml1)
29        else
30           if (dbg) print *, 'expected 16 32 got ',num1,num2
31           call abort
32        endif
33        num3 = -1
34        num4 = -1
35        read(10,mynml2)
36        if (num3.eq.42.and.num4.eq.56) then
37           if (dbg) write(*,mynml2)
38        else
39           if (dbg) print *, 'expected 42 56 got ',num3,num4
40           call abort
41        endif
42
43        close(10)
44        end