This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,libgfortran] PR28335 flush() / write() statement on closed units


I've just run across the effects of this in the 20060729 snapshot, where
previously working code got runtime errors. It seems that Jerry's patch
makes it an error to attempt to CLOSE a unit which has not been OPENED, or
"associated". My reading of the f77 standard and a late draft of the 2003
standard show this to be explicitly permitted. I couldn't easily access the
F90 or F95 standards.

When I get access again to my other system, I can file a bugzilla report, if
this is the appropriate thing to do.

As a user whose (possibly misguided) program stopped working, I'll also confess to some brief irritation at the error text, "Can't find specified UNIT in CLOSE". In essence, the runtime knows I want to do a CLOSE on a specific UNIT, and it
has a problem with that, but it won't tell me which UNIT. I'm afraid that looking at error.c didn't give me a clearer idea of how a more useful error message could have been given within the existing program structure.


Michael Paton


Jerry DeLisle wrote: > I plan to commit to trunk the attached trivial patch in 24 hours.

> Regression tested OK after getting rid of a loose CLOSE(10) statement in > gfortran.dg/temporary_1.f90. Fixed test case attached has nothing to do with > I/O

> Regards,

> Jerry

> 2006-07-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>

> 	PR libgfortran/258335
> 	* close.c (st_close): Add error when UNIT does not exist.
> 	* file_pos.c (st_flush): Add error when UNIT does not exist.



Index: io/close.c
===================================================================
*** io/close.c	(revision 115692)
--- io/close.c	(working copy)
*************** st_close (st_parameter_close *clp)
*** 102,107 ****
          unlink (path);
  #endif
      }
!
    library_end ();
  }
--- 102,109 ----
          unlink (path);
  #endif
      }
!   else
!     generate_error (&clp->common, ERROR_BAD_OPTION,
! 			    "Can't find specified UNIT in CLOSE");
    library_end ();
  }

! { dg-do run }
! PR 27662. Don't zero the first stride to indicate a temporary. It
! may be used later.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]