diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2005-01-23 02:18:33 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2005-01-23 02:18:33 +0000 |
commit | 0e69bba9fc926fd529f51aa9e7f585c27b88c1e3 (patch) | |
tree | cd9cbaee37fb9b2e5ac2977b499c8db30a3c44d1 | |
parent | c2d8571d9189c836d8757d2e62c700f0b7f101cb (diff) | |
download | gcc-0e69bba9fc926fd529f51aa9e7f585c27b88c1e3.zip gcc-0e69bba9fc926fd529f51aa9e7f585c27b88c1e3.tar.gz gcc-0e69bba9fc926fd529f51aa9e7f585c27b88c1e3.tar.bz2 |
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
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/open_readonly_1.f90 | 14 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 3 |
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b39fb69..f63c8db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gfortran.dg/open_new.f90: New file. diff --git a/gcc/testsuite/gfortran.dg/open_readonly_1.f90 b/gcc/testsuite/gfortran.dg/open_readonly_1.f90 new file mode 100644 index 0000000..622a07d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/open_readonly_1.f90 @@ -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 + diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c2218fb..1296ab2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 114ed92..1dcbc7f 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -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) |