! { dg-do run }
|
! { dg-do run }
|
! PR17286
|
! PR17286
|
! Namelist read failed when spaces exist between the '=' and the numbers
|
! Namelist read failed when spaces exist between the '=' and the numbers
|
! This is a libgfortran bug
|
! This is a libgfortran bug
|
! Derived from testcase provided by Paul Thomas
|
! Derived from testcase provided by Paul Thomas
|
program bug3
|
program bug3
|
integer num1 , num2 , num3 , num4
|
integer num1 , num2 , num3 , num4
|
data num3 / 42 /
|
data num3 / 42 /
|
data num4 / 56 /
|
data num4 / 56 /
|
namelist /mynml1/ num1,num2
|
namelist /mynml1/ num1,num2
|
namelist /mynml2/ num3,num4
|
namelist /mynml2/ num3,num4
|
logical dbg
|
logical dbg
|
data dbg / .FALSE. /
|
data dbg / .FALSE. /
|
open(unit=10,status='SCRATCH')
|
open(unit=10,status='SCRATCH')
|
write(10,'(A)') "&mynml1,num1= 16,num2=32,&end"
|
write(10,'(A)') "&mynml1,num1= 16,num2=32,&end"
|
!
|
!
|
! write mynml2
|
! write mynml2
|
!
|
!
|
write(10,mynml2)
|
write(10,mynml2)
|
rewind(10)
|
rewind(10)
|
!
|
!
|
! now read back
|
! now read back
|
!
|
!
|
num1 = -1
|
num1 = -1
|
num2 = -1
|
num2 = -1
|
read(10,mynml1)
|
read(10,mynml1)
|
if (num1.eq.16.and.num2.eq.32) then
|
if (num1.eq.16.and.num2.eq.32) then
|
if (dbg) write(*,mynml1)
|
if (dbg) write(*,mynml1)
|
else
|
else
|
if (dbg) print *, 'expected 16 32 got ',num1,num2
|
if (dbg) print *, 'expected 16 32 got ',num1,num2
|
call abort
|
call abort
|
endif
|
endif
|
num3 = -1
|
num3 = -1
|
num4 = -1
|
num4 = -1
|
read(10,mynml2)
|
read(10,mynml2)
|
if (num3.eq.42.and.num4.eq.56) then
|
if (num3.eq.42.and.num4.eq.56) then
|
if (dbg) write(*,mynml2)
|
if (dbg) write(*,mynml2)
|
else
|
else
|
if (dbg) print *, 'expected 42 56 got ',num3,num4
|
if (dbg) print *, 'expected 42 56 got ',num3,num4
|
call abort
|
call abort
|
endif
|
endif
|
|
|
close(10)
|
close(10)
|
end
|
end
|
|
|