| 1 |
! { dg-do run { target fd_truncate } } |
| 2 |
! PR69456 Namelist value with trailing sign is ignored without error |
| 3 |
implicit none |
| 4 |
integer :: ios |
| 5 |
character(256) :: errormsg |
| 6 |
real :: r1 = -1 |
| 7 |
real :: r2 = -1 |
| 8 |
real :: r3 = -1 |
| 9 |
real :: r4 = -1 |
| 10 |
complex :: c1 = (-1,-1) |
| 11 |
namelist /nml/ r1, r2, r3, r4, c1 |
| 12 |
|
| 13 |
open (99, status="scratch") |
| 14 |
|
| 15 |
write(99,*) "&nml" |
| 16 |
write(99,*) " r1=1+1" ! Treated as 1e+1! |
| 17 |
write(99,*) " r2=1-1" ! Treated as 1e-1! |
| 18 |
write(99,*) " r3=1+1" ! Treated as 1e+1! |
| 19 |
write(99,*) " r4=1-1" ! Treated as 1e-1! |
| 20 |
write(99,*) " c1=(1-,1+1)" ! Should give error on item number 5 |
| 21 |
write(99,*) "/" |
| 22 |
|
| 23 |
rewind(99) |
| 24 |
|
| 25 |
read (99, nml=nml, iostat=ios, iomsg=errormsg) |
| 26 |
if (ios.ne.5010) STOP 1 |
| 27 |
if (scan(errormsg, "5").ne.44) STOP 2 |
| 28 |
|
| 29 |
rewind(99) |
| 30 |
|
| 31 |
write(99,*) "&nml" |
| 32 |
write(99,*) " r1=1+1" ! Treated as 1e+1! |
| 33 |
write(99,*) " r2=1-" ! Should give error on item number 2 |
| 34 |
write(99,*) " r3=1+1" ! Treated as 1e+1! |
| 35 |
write(99,*) " r4=1-1" ! Treated as 1e-1! |
| 36 |
write(99,*) " c1=(1-1,1+1)" ! Treated as (1e-1,1e+1)! |
| 37 |
write(99,*) "/" |
| 38 |
|
| 39 |
rewind(99) |
| 40 |
|
| 41 |
read (99, nml=nml, iostat=ios, iomsg=errormsg) |
| 42 |
if (ios.ne.5010) STOP 3 |
| 43 |
if (scan(errormsg, "2").ne.25) STOP 4 |
| 44 |
|
| 45 |
close (99) |
| 46 |
|
| 47 |
end |