Issue |
126264
|
Summary |
[Flang] Unexpected runtime I/O error related to finalization
|
Labels |
flang:runtime
|
Assignees |
|
Reporter |
DanielCChen
|
Consider the following code
```
module m
type base
integer*4 :: id
contains
procedure :: makeArray => createBaseArray
final :: finalizeBaseRank1
end type
type (base) :: b1_m
contains
function createBaseArray (b, n)
class (base), intent(in) :: b
integer*4, intent(in) :: n
class (base), allocatable :: createBaseArray (:)
allocate (createBaseArray(n))
createBaseArray%id = b%id
end function
subroutine finalizeBaseRank1 (b)
type(base) :: b(:)
print *, 'finalizeBaseRank1'
end subroutine
end module
program ftpbnd516a
use m
print*, size (b1_m%makeArray (3))
end
```
Flang currently issues a runtime I/O error as:
```
> a.out
fatal Fortran runtime error(/home/cdchen/temp/t.f:28): Recursive I/O attempted on unit 6
3IOT/Abort trap(coredump)
```
It seems the print statement in the main program got interfered with the print statement in the finalization routine.
All ifort, gfortran and XLF executed the program successfully.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs