llvm / llvm/llvm-project

[flang] _FortranAExit does not have [[noreturn]] semantic

Open
#170,591 3 comments 0 reactions 1 assignee Claimed by @eugeneepshteyn View on GitHub
flang
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

For the following code:
```fortran
integer function KOHb_exit(status)
integer, intent(in) :: status
if (status > 0) call exit(status) ! actually, _FortranAExit
KOHb_exit = 0
do i = 1, status
print '(A,I0)', "KOHb #", i
end do
end function KOHb_exit
```
one would expect that this code will never have print statement in ASM at high level of optimizations, since execution after `exit` is not possible. However, current LLVM flang generates print statements at -O3:
https://godbolt.org/z/EzK3nWfrq

For `error stop` (as well as `stop`), the code looks cool:
https://godbolt.org/z/7bvhf4Ef3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.