re PR libfortran/19451 (Read after a write with a read only file)

2005-01-22  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/19451
	* io/transfer.c (finalize_transfer):  Don't do anything if
	there is an error condition.
	* open_readonly_1.f90:  New test.

From-SVN: r94101
This commit is contained in:
Thomas Koenig 2005-01-23 02:18:33 +00:00 committed by Paul Brook
parent c2d8571d91
commit 0e69bba9fc
4 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-01-22 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/19451
* open_readonly_1.f90: New test.
2005-01-22 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/18982

View File

@ -0,0 +1,14 @@
! { dg-do run }
! PR19451
! Writing to a non-empty readonly file caused a segfault.
! We were still trying to write the EOR after an error ocurred
program prog
open (unit=10, file='PR19451.dat')
write (10,*) "Hello World"
close (10)
open (unit=10, file='PR19451.dat', action="read")
write (10,*,err=20) "Hello World"
call abort()
20 continue
end program

View File

@ -1,3 +1,9 @@
2005-01-22 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/19451
* io/transfer.c (finalize_transfer): Don't do anything if
there is an error condition.
2005-01-22 David Edelsohn <edelsohn@gnu.org>
PR libgfortran/19052

View File

@ -1389,6 +1389,9 @@ next_record (int done)
static void
finalize_transfer (void)
{
if (ioparm.library_return != LIBRARY_OK)
return;
if ((ionml != NULL) && (ioparm.namelist_name != NULL))
{
if (ioparm.namelist_read_mode)