Issue 122150
Summary [flang][runtime][IO] OPEN statement core dumps at runtime with not-existent file
Labels flang
Assignees
Reporter mjklemm
    When compiling below reproducer and running it with the opened file not being there, the executable core dumps:

```
$  flang-new -o readtest ./readtest.f90       
$  ./readtest 

fatal Fortran runtime error(/path/path/path/readtest.f90:9): End of file during input
[1]    1099765 IOT instruction (core dumped) ./readtest
```

The expected output would be:

```
 ERROR
```

Reproducer:

```Fortran
program readtest
    implicit none
    character(len=10) :: dir_app
    real(8) :: rdum, rispin
 integer :: idum

    open(unit=12, file='data1.dat', access='direct', form='unformatted',status='unknown', recl=128)

 read(12,rec=1,err=17421) rdum,rispin ; idum=nint(rdum)

    write (*,*) rdum, rispin
    return

    17421 write(*,*) "ERROR"
end program
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to