Skip to content

Commit 6c516cd

Browse files
committed
[flang] Recognize END FILE as ENDFILE in free form source
The ENDFILE statement may be spelled as two words. Differential revision: https://reviews.llvm.org/D91377
1 parent 3a7b57b commit 6c516cd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

flang/lib/Parser/io-parsers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ TYPE_CONTEXT_PARSER("BACKSPACE statement"_en_US,
314314
// R1225 endfile-stmt ->
315315
// ENDFILE file-unit-number | ENDFILE ( position-spec-list )
316316
TYPE_CONTEXT_PARSER("ENDFILE statement"_en_US,
317-
construct<EndfileStmt>("ENDFILE" >> positionOrFlushSpecList))
317+
construct<EndfileStmt>("END FILE" >> positionOrFlushSpecList))
318318

319319
// R1226 rewind-stmt -> REWIND file-unit-number | REWIND ( position-spec-list )
320320
TYPE_CONTEXT_PARSER("REWIND statement"_en_US,

flang/test/Semantics/call10.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ pure subroutine s12
157157
close(1) ! C1597
158158
!ERROR: External I/O is not allowed in a pure subprogram
159159
backspace(1) ! C1597
160+
!Also checks parsing of variant END FILE spelling
160161
!ERROR: External I/O is not allowed in a pure subprogram
161-
endfile(1) ! C1597
162+
end file(1) ! C1597
162163
!ERROR: External I/O is not allowed in a pure subprogram
163164
rewind(1) ! C1597
164165
!ERROR: External I/O is not allowed in a pure subprogram

0 commit comments

Comments
 (0)