[flang] Delay parse tree rewriting for I/O UNIT=func()
authorPeter Klausler <pklausler@nvidia.com>
Tue, 4 Oct 2022 17:42:42 +0000 (10:42 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Thu, 6 Oct 2022 18:29:41 +0000 (11:29 -0700)
commit7ff9064b2609f2bcc8ca277f8cbb7f2f17d8e369
treed4c8f6f87bfe9d824b63717be143976ada203d99
parente2eabb7ed5e90ddf397bc3c41ec3fbab51a403c1
[flang] Delay parse tree rewriting for I/O UNIT=func()

When an I/O statement's UNIT= specifier is a variable that is a
function reference, parse tree rewriting may determine the wrong type
of the result because generic resolution has not yet been performed.
So move this bit of parse tree rewriting into I/O semantic
checking so that the right handling (integer -> external file unit
number, character pointer -> internal I/O) applies.

Differential Revision: https://reviews.llvm.org/D135210
flang/lib/Semantics/check-io.cpp
flang/lib/Semantics/rewrite-parse-tree.cpp
flang/test/Semantics/io04.f90
flang/test/Semantics/io13.f90 [new file with mode: 0644]