| 1 |
! { dg-do run { target fd_truncate } } |
| 2 |
! PR25835 Check that reading from a file that is at end-of-file does not |
| 3 |
! segfault or give error. Test case derived from example in PR from Dale Ranta. |
| 4 |
! Contributed by Jerry DeLisle <[email protected]> |
| 5 |
integer data(5000) |
| 6 |
data=-256 |
| 7 |
open(unit=11,status='scratch', form='unformatted') |
| 8 |
write(11)data |
| 9 |
write(11)data |
| 10 |
read(11,end= 1000 )data |
| 11 |
STOP 1 |
| 12 |
1000 continue |
| 13 |
backspace 11 |
| 14 |
rewind 11 |
| 15 |
write(11)data |
| 16 |
read(11,end= 1001 )data |
| 17 |
STOP 2 |
| 18 |
1001 continue |
| 19 |
data = 0 |
| 20 |
backspace 11 |
| 21 |
rewind 11 |
| 22 |
read(11,end= 1002 )data |
| 23 |
if (.not. all(data == -256)) STOP 3 |
| 24 |
1002 continue |
| 25 |
read(11,end= 1003 )data |
| 26 |
STOP 4 |
| 27 |
1003 continue |
| 28 |
close(11) |
| 29 |
end |
| 30 |
|
| 31 |
|