Issue |
150306
|
Summary |
[flang] The presence of `iostat=` specifier doesn't stop Flang runtime from crashing.
|
Labels |
flang:runtime
|
Assignees |
|
Reporter |
DanielCChen
|
Consider the following code:
```
module m
type base
contains
procedure :: writeBaseFmt
generic :: write (formatted) => writeBaseFmt
end type
contains
subroutine writeBaseFmt (dtv, unit, iotype, v_list, iostat, iomsg)
class(base), intent(in) :: dtv
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
character(:), allocatable :: decMode
allocate (character(20) :: decMode)
inquire(unit, decimal=decMode, iostat=iostat, iomsg=iomsg) !! Should not crash with the same runtime error.
print*, iostat
print*, iomsg
if (iostat == 0) error stop 1
end subroutine
end module
program dcmlChildWrite003
use m
character(3) :: string1
type(base) :: b1
string1 = 'abc'
write (string1, '(dc, DT)') b1
end
```
Flang failed at runtime with
```
> a.out
256
INQUIRE of unit created for defined derived type I/O of an internal unit
fatal Fortran runtime error(t.f:40): INQUIRE of unit created for defined derived type I/O of an internal unit
IOT/Abort trap(coredump)
```
While the `iostat=` specifier caught the runtime error that the test case intended to test, the runtime still crashes with the exact same error.
The expected behavior should be `error stop 1`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs