diff --git a/flang/lib/Parser/io-parsers.cpp b/flang/lib/Parser/io-parsers.cpp --- a/flang/lib/Parser/io-parsers.cpp +++ b/flang/lib/Parser/io-parsers.cpp @@ -314,7 +314,7 @@ // R1225 endfile-stmt -> // ENDFILE file-unit-number | ENDFILE ( position-spec-list ) TYPE_CONTEXT_PARSER("ENDFILE statement"_en_US, - construct("ENDFILE" >> positionOrFlushSpecList)) + construct("END FILE" >> positionOrFlushSpecList)) // R1226 rewind-stmt -> REWIND file-unit-number | REWIND ( position-spec-list ) TYPE_CONTEXT_PARSER("REWIND statement"_en_US, diff --git a/flang/test/Semantics/call10.f90 b/flang/test/Semantics/call10.f90 --- a/flang/test/Semantics/call10.f90 +++ b/flang/test/Semantics/call10.f90 @@ -157,8 +157,9 @@ close(1) ! C1597 !ERROR: External I/O is not allowed in a pure subprogram backspace(1) ! C1597 + !Also checks parsing of variant END FILE spelling !ERROR: External I/O is not allowed in a pure subprogram - endfile(1) ! C1597 + end file(1) ! C1597 !ERROR: External I/O is not allowed in a pure subprogram rewind(1) ! C1597 !ERROR: External I/O is not allowed in a pure subprogram