[patch, libfortran] Fix PR 23598, iostat handling after library error
Thomas Koenig
Thomas.Koenig@online.de
Sun Aug 28 14:56:00 GMT 2005
This is the reason why the original test case from
http://gcc.gnu.org/ml/fortran/2005-08/msg00307.html failed.
Regression-tested on mainline.
OK for mainline, and for 4.0 once I've regression-tested it there?
Thomas
2005-08-28 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/23598
* io/lock.c(library_start): If iostat is present, clear
ioparm.library_return unconditionally.
2005-02-28 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/23598
* gfortran.dg/iostat_1.f90: New test.
:ADDPATCH libfortran:
-------------- next part --------------
Index: lock.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/lock.c,v
retrieving revision 1.8
diff -c -p -r1.8 lock.c
*** lock.c 17 Aug 2005 02:48:56 -0000 1.8
--- lock.c 28 Aug 2005 10:53:18 -0000
*************** library_start (void)
*** 54,60 ****
stay within the library. */
g.in_library = 1;
! if (ioparm.iostat != NULL && ioparm.library_return == LIBRARY_OK)
*ioparm.iostat = ERROR_OK;
ioparm.library_return = LIBRARY_OK;
--- 54,60 ----
stay within the library. */
g.in_library = 1;
! if (ioparm.iostat != NULL)
*ioparm.iostat = ERROR_OK;
ioparm.library_return = LIBRARY_OK;
-------------- next part --------------
! { dg-do run }
! PR 23598 - The iostat variable wasn't reset if the previous
! I/O library call had an error.
program main
implicit none
integer :: ios, i
open (10, pad='no', status='scratch')
write (10, '(A)') '1','1'
rewind (10)
read (10,'(I2)',iostat=ios) i
ios = -4321
read (10, '(I1)', iostat=ios) i
if (ios /= 0) call abort
end program main
More information about the Fortran
mailing list