| 1 |
! { dg-final { scan-assembler-not "should_be_noreturn" } } |
| 2 |
! PR 17758 |
| 3 |
! This checks that non-returning subroutines and statements |
| 4 |
! really don't return by calling non-existing subroutines |
| 5 |
! afterwards. These calls are supposed to be optimized away, so |
| 6 |
! they won't show up in the generated assembly. |
| 7 |
program main |
| 8 |
character(len=5) :: c |
| 9 |
c = '12345' |
| 10 |
read(unit=c,fmt='(A)') i |
| 11 |
select case(i) |
| 12 |
case(1) |
| 13 |
STOP 1 |
| 14 |
call abort_should_be_noreturn |
| 15 |
case(2) |
| 16 |
stop 65 |
| 17 |
call stop_numeric_should_be_noreturn |
| 18 |
case(3) |
| 19 |
stop "foobar" |
| 20 |
call stop_string_should_be_noreturn |
| 21 |
case(4) |
| 22 |
call exit |
| 23 |
call exit_should_be_noreturn |
| 24 |
end select |
| 25 |
end program main |