This is the mail archive of the
mailing list for the GCC project.
Re: [gfortran,patch] Add checks for OPEN and CLOSE statements
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: gfortran List <fortran at gcc dot gnu dot org>, patch patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 12 Oct 2006 16:16:52 -0700
- Subject: Re: [gfortran,patch] Add checks for OPEN and CLOSE statements
- References: <C722CA5A-B644-4CE7-8596-1BFE9B0E374F@gmail.com>
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.
--- 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/
+compare_to_allowed_values (const char * specifier, const char * allowed,
+ const char * allowed_f2003,