Issue 170591
Summary [flang] _FortranAExit does not have [[noreturn]] semantic
Labels flang
Assignees
Reporter foxtran
    For the following code:
```fortran
integer function KOHb_exit(status)
 integer, intent(in) :: status
  fast_exit = status
  if (status > 0) call exit(status) ! actually, _FortranAExit
  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
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to