Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Detect and rewrite ambiguous READ(CVAR)[,item-list]
READ(CVAR)[,item-list] with a character variable CVAR could be parsed as an unformatted READ from an internal unit or as a formatted READ from the default external unit with a needlessly parenthesized variable format. We parse it as the former, but Fortran doesn't have unformatted internal I/O. Differential revision: https://reviews.llvm.org/D90493
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
! RUN: %f18 -fparse-only -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s | ||
! Ensure that READ(CVAR) [, item-list] is corrected when CVAR is a | ||
! character variable so as to be a formatted read from the default | ||
! unit, not an unformatted read from an internal unit (which is not | ||
! possible in Fortran). | ||
character :: cvar | ||
! CHECK-NOT: IoUnit -> Variable -> Designator -> DataRef -> Name = 'cvar' | ||
! CHECK: Format -> Expr = 'cvar' | ||
read(cvar) | ||
end |