This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, 4.8/4.9/5 Regression] PR59513 READ or WRITE not allowed after EOF
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 22 Mar 2015 14:05:05 -0700
- Subject: Re: [Patch, Fortran, 4.8/4.9/5 Regression] PR59513 READ or WRITE not allowed after EOF
- Authentication-results: sourceware.org; auth=none
- References: <550C9E2A dot 2060501 at charter dot net> <CAO9iq9HPdmj37DgChhcW96GB_nvtUFFFbm8M7z6zHJDYkQa_9Q at mail dot gmail dot com>
On 03/22/2015 08:47 AM, Janne Blomqvist wrote:
On Sat, Mar 21, 2015 at 12:24 AM, Jerry DeLisle <jvdelisle@charter.net> wrote:
The attached patch allows the attempt to READ or WRITE after an EOF for
legacy code. The runtime error is suppressed for -std=legacy and -std=gnu.
For standard conformance the error is retained as is now.
Since it's a standard violation rather than a GNU extension, I'd
prefer if it were enabled only with -std=legacy.
Ok with this change.
The attached patch adds documentation under 'extensions' in gfortran.texi.
Tested with make html.
I will commit soon with a ChangeLog entry
Regards,
Jerry
Index: gfortran.texi
===================================================================
--- gfortran.texi (revision 221544)
+++ gfortran.texi (working copy)
@@ -1404,6 +1404,7 @@ without warning.
* OpenMP::
* OpenACC::
* Argument list functions::
+* Read/Write after EOF marker::
@end menu
@node Old-style kind specifications
@@ -2049,7 +2050,19 @@ For details refer to the g77 manual
Also, @code{c_by_val.f} and its partner @code{c_by_val.c} of the
GNU Fortran testsuite are worth a look.
+@node Read/Write after EOF marker
+@subsection Read/Write after EOF marker
+@cindex @code{EOF}
+@cindex @code{BACKSPACE}
+@cindex @code{REWIND}
+Some legacy codes rely on allowing @code{READ} or @code{WRITE} after the
+EOF file marker in order to find the end of a file. GNU Fortran normally
+rejects these codes with a run-time error message and suggests the user
+consider @code{BACKSPACE} or @code{REWIND} to properly position
+the file before the EOF marker. As an extension, the run-time error may
+be disabled using -std=legacy.
+
@node Extensions not implemented in GNU Fortran
@section Extensions not implemented in GNU Fortran
@cindex extensions, not implemented