diff options
| author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-30 00:17:03 +0000 |
|---|---|---|
| committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-30 00:17:03 +0000 |
| commit | 98044a6d8fde8091dcbb8d7aa7c2781daff56354 (patch) | |
| tree | b4d86a23443c994803d84ca705df454f77834cfb | |
| parent | 97b007be01f3859ea962c88f95111391b0029019 (diff) | |
| download | ppe42-gcc-98044a6d8fde8091dcbb8d7aa7c2781daff56354.tar.gz ppe42-gcc-98044a6d8fde8091dcbb8d7aa7c2781daff56354.zip | |
fortran/PR20846
* io.c (gfc_match_inquire): Implement constraints on UNIT and FILE usage.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100338 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/fortran/io.c | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b10aea28ee1..ac6a5d8134e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2005-05-29 Steven G. Kargl + + fortran/PR20846 + * io.c (gfc_match_inquire): Implement constraints on UNIT and FILE usage. + 2005-05-29 Francois-Xavier Coudert <coudert@clipper.ens.fr> PR libfortran/20006 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 5fae9a2d094..7777f05a410 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"); |

