Skip to content

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

@foxtran

Description

@foxtran

For the following code:

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

Metadata

Metadata

Labels

flangFlang issues not falling into any other category

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions