This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] PATCH
- From: FranÃois-Xavier Coudert <Francois-Xavier dot Coudert at lcp dot u-psud dot fr>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Mar 2005 19:12:22 +0100
- Subject: [gfortran] PATCH
- Organization: Laboratoire de Chimie Physique
Hi all,
The attached one-line patch fixes the second bug in PR libfortran/20163.
In case an error occured during an OPEN statement, we currently return
without calling library_end() before, which means any subsequent I/O
statement is doomed.
The debugging and diagnosis for this problem are due to Dale Ranta.
*strapped and regtested on i686-linux for both mainline and 4.0. OK for
commit?
2005-03-17 Dale Ranta <dir@lanl.gov>
Francois-Xavier Coudert <coudert@clipper.ens.fr>
* io/open.c (st_open): call library_end() before returning even if
an error arises.
2005-03-17 Dale Ranta <dir@lanl.gov>
Francois-Xavier Coudert <coudert@clipper.ens.fr>
* gfortran.dg/pr20163-2.f: New test.
open(10,status="foo",err=100)
call abort
100 continue
open(10,status="scratch")
end
Index: libgfortran/io/open.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/open.c,v
retrieving revision 1.11
diff -p -u -r1.11 open.c
--- libgfortran/io/open.c 16 Mar 2005 19:32:07 -0000 1.11
+++ libgfortran/io/open.c 24 Mar 2005 18:08:49 -0000
@@ -481,7 +481,10 @@ st_open (void)
flags.position = POSITION_ASIS;
if (ioparm.library_return != LIBRARY_OK)
+ {
+ library_end ();
return;
+ }
u = find_unit (ioparm.unit);