[llvm] [flang-rt] Fix runtime error when opening the same file on multiple units. (PR #190743)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 06:17:41 PDT 2026


https://github.com/jeanPerier commented:

This is not a bug and was a deliberate choice to not support this.

The sentence in the standard that you mentioned in the RFC leaves the choice to flang to support it or not.

"whether a file can be connected to more than one unit at the same time" is listed in "A.2 Processor dependencies".

The processor does not only mean the OS, it is the combination of the compiler, its runtime and the OS. So such Fortran code should not expected to be portable and Flang is free to not support it.

Flang IO runtime is using buffers for each unit for faster IO operations, so connecting the files to multiple unit will lead to invalid buffer/file states.

https://github.com/llvm/llvm-project/pull/190743


More information about the llvm-commits mailing list