Commit 44998b65 by Janne Blomqvist Committed by Steven G. Kargl

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
parent 93ef85a2
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> 2005-05-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20006 PR libfortran/20006
......
...@@ -2363,6 +2363,7 @@ gfc_match_inquire (void) ...@@ -2363,6 +2363,7 @@ gfc_match_inquire (void)
gfc_inquire *inquire; gfc_inquire *inquire;
gfc_code *code; gfc_code *code;
match m; match m;
locus loc;
m = gfc_match_char ('('); m = gfc_match_char ('(');
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -2370,6 +2371,8 @@ gfc_match_inquire (void) ...@@ -2370,6 +2371,8 @@ gfc_match_inquire (void)
inquire = gfc_getmem (sizeof (gfc_inquire)); inquire = gfc_getmem (sizeof (gfc_inquire));
loc = gfc_current_locus;
m = match_inquire_element (inquire); m = match_inquire_element (inquire);
if (m == MATCH_ERROR) if (m == MATCH_ERROR)
goto cleanup; goto cleanup;
...@@ -2435,6 +2438,20 @@ gfc_match_inquire (void) ...@@ -2435,6 +2438,20 @@ gfc_match_inquire (void)
if (gfc_match_eos () != MATCH_YES) if (gfc_match_eos () != MATCH_YES)
goto syntax; 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)) if (gfc_pure (NULL))
{ {
gfc_error ("INQUIRE statement not allowed in PURE procedure at %C"); gfc_error ("INQUIRE statement not allowed in PURE procedure at %C");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment