[gfortran,patch] Add checks for OPEN and CLOSE statements
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Oct 13 00:15:00 GMT 2006
On Sun, Oct 08, 2006 at 05:58:30PM +0200, FX Coudert wrote:
> Hi all,
>
> Attached patch adds compile-time checks for OPEN and CLOSE specifiers
> that happen to have constant values. We can check the value of each
> such specifier against the list of values allowed by a given
> standard. We can also now check at compile-time some invalid
> combinations, e.g. open(10,access="direct",position="append") is not
> allowed because position="append" should only happen for stream or
> sequential access.
>
> Of course, when the IOSTAT or ERR specifier is present, the front-end
> only generates a warning.
>
> Regtested on x86_64-linux, comes with a pretty extensive test
> coverage. A few gfortran testsuite files had to be modified to
> account for the warnings now issued. OK for mainline?
>
Yes with one comment.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (revision 117533)
+++ gcc/fortran/io.c (working copy)
@@ -1253,6 +1253,99 @@
}
+
+/* Check if a given value for a SPECIFIER is either in the list of values
+ allowed in F95 or F2003, issuing an error message and returning a zero
+ value it is not allowed. */
s/it is/if it is/
+static int
+compare_to_allowed_values (const char * specifier, const char * allowed[],
+ const char * allowed_f2003[],
--
Steve
More information about the Fortran
mailing list