[flang-commits] [flang] 6c516cd - [flang] Recognize END FILE as ENDFILE in free form source

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu Nov 12 12:53:01 PST 2020


Author: peter klausler
Date: 2020-11-12T12:46:04-08:00
New Revision: 6c516cda39745ddb931165caadf52911d7ea0f96

URL: https://github.com/llvm/llvm-project/commit/6c516cda39745ddb931165caadf52911d7ea0f96
DIFF: https://github.com/llvm/llvm-project/commit/6c516cda39745ddb931165caadf52911d7ea0f96.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Parser/io-parsers.cpp
    flang/test/Semantics/call10.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/io-parsers.cpp b/flang/lib/Parser/io-parsers.cpp
index 0aab883ea8f7..6294e5c40ab9 100644
--- a/flang/lib/Parser/io-parsers.cpp
+++ b/flang/lib/Parser/io-parsers.cpp
@@ -314,7 +314,7 @@ TYPE_CONTEXT_PARSER("BACKSPACE statement"_en_US,
 // R1225 endfile-stmt ->
 //         ENDFILE file-unit-number | ENDFILE ( position-spec-list )
 TYPE_CONTEXT_PARSER("ENDFILE statement"_en_US,
-    construct<EndfileStmt>("ENDFILE" >> positionOrFlushSpecList))
+    construct<EndfileStmt>("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
index e7b29c7f45c5..803726cc1168 100644
--- a/flang/test/Semantics/call10.f90
+++ b/flang/test/Semantics/call10.f90
@@ -157,8 +157,9 @@ pure subroutine s12
     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


        


More information about the flang-commits mailing list