[patch, libgfortran] Fix for PR 19451
Thomas Koenig
Thomas.Koenig@online.de
Wed Jan 19 22:02:00 GMT 2005
This was bubblestrapped and regtested on i386-unknown-linux-gnu.
I consider this a trivial patch, which I gladly donate to the FSF.
Ok?
Thomas
2005-01-19 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/19451
* io/transfer.c (finalize_transfer): Don't do anything if
there is an error condition.
PR libfortran/19451
* open_readonly_file.f90: New test
-------------- next part --------------
Index: transfer.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.26
diff -r1.26 transfer.c
1385a1386,1388
> if (ioparm.library_return != LIBRARY_OK)
> return;
>
-------------- next part --------------
! { dg do-run }
! PR 19451 : writing to a read-only file with contents
! would cause a segfault when iostat or err were present
program main
call system("rm -f asdf.dat; echo foo > asdf.dat; chmod u-w asdf.dat")
open(file="asdf.dat",unit=10,action="read")
write(10,*,iostat=i) "Hello, world"
if (iostat == 0) call abort
write(10,*,err=20) "Hello, world"
call abort
20 continue
end
More information about the Gcc-patches
mailing list