diff options
author | Janne Blomqvist <jblomqvi@vipunen.hut.fi> | 2005-05-30 00:17:03 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-05-30 00:17:03 +0000 |
commit | 44998b65262206d2dacc1dcabca5c80ea8c4a84b (patch) | |
tree | b4d86a23443c994803d84ca705df454f77834cfb /gcc/fortran/io.c | |
parent | 93ef85a292c7ec295ba53ba5f3dcb258f424b5a0 (diff) | |
download | gcc-44998b65262206d2dacc1dcabca5c80ea8c4a84b.zip gcc-44998b65262206d2dacc1dcabca5c80ea8c4a84b.tar.gz gcc-44998b65262206d2dacc1dcabca5c80ea8c4a84b.tar.bz2 |
re PR fortran/20846 (inquire(FILE=..., UNIT=...) not flagged as error)
fortran/PR20846
* io.c (gfc_match_inquire): Implement constraints on UNIT and FILE usage.
From-SVN: r100338
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 5fae9a2d..7777f05 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2363,6 +2363,7 @@ gfc_match_inquire (void) gfc_inquire *inquire; gfc_code *code; match m; + locus loc; m = gfc_match_char ('('); if (m == MATCH_NO) @@ -2370,6 +2371,8 @@ gfc_match_inquire (void) inquire = gfc_getmem (sizeof (gfc_inquire)); + loc = gfc_current_locus; + m = match_inquire_element (inquire); if (m == MATCH_ERROR) goto cleanup; @@ -2435,6 +2438,20 @@ gfc_match_inquire (void) if (gfc_match_eos () != MATCH_YES) goto syntax; + if (inquire->unit != NULL && inquire->file != NULL) + { + gfc_error ("INQUIRE statement at %L cannot contain both FILE and" + " UNIT specifiers", &loc); + goto cleanup; + } + + if (inquire->unit == NULL && inquire->file == NULL) + { + gfc_error ("INQUIRE statement at %L requires either FILE or" + " UNIT specifier", &loc); + goto cleanup; + } + if (gfc_pure (NULL)) { gfc_error ("INQUIRE statement not allowed in PURE procedure at %C"); |