Commit 0e69bba9 by Thomas Koenig Committed by Paul Brook

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
parent c2d8571d
2005-01-22 Thomas Koenig <Thomas.Koenig@online.de> 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 PR libfortran/18982
* gfortran.dg/open_new.f90: New file. * gfortran.dg/open_new.f90: New file.
......
! { 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
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> 2005-01-22 David Edelsohn <edelsohn@gnu.org>
PR libgfortran/19052 PR libgfortran/19052
......
...@@ -1389,6 +1389,9 @@ next_record (int done) ...@@ -1389,6 +1389,9 @@ next_record (int done)
static void static void
finalize_transfer (void) finalize_transfer (void)
{ {
if (ioparm.library_return != LIBRARY_OK)
return;
if ((ionml != NULL) && (ioparm.namelist_name != NULL)) if ((ionml != NULL) && (ioparm.namelist_name != NULL))
{ {
if (ioparm.namelist_read_mode) if (ioparm.namelist_read_mode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment