| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-O2 -Wuninitialized" } |
| 3 |
|
| 4 |
subroutine foo1 |
| 5 |
implicit none |
| 6 |
interface |
| 7 |
subroutine bar1 |
| 8 |
!GCC$ ATTRIBUTES noreturn :: bar1 |
| 9 |
end subroutine |
| 10 |
end interface |
| 11 |
real,allocatable :: d(:) ! { dg-note "declared here" "note" } |
| 12 |
d = 0. ! { dg-warning "used uninitialized" "uninitialized descriptor" } |
| 13 |
call bar1() |
| 14 |
d = 0. ! { dg-bogus "warning:" "not optimized out" } |
| 15 |
end subroutine foo1 |
| 16 |
|
| 17 |
function foo2() |
| 18 |
integer :: foo2 |
| 19 |
interface |
| 20 |
subroutine bar2 |
| 21 |
!GCC$ ATTRIBUTES noreturn :: bar2 |
| 22 |
end subroutine |
| 23 |
end interface |
| 24 |
call bar2 |
| 25 |
return ! { dg-bogus "__result_foo2' is used uninitialized" "return" } |
| 26 |
foo2 = 0 |
| 27 |
end function foo2 |
| 28 |
|
| 29 |
subroutine foo3 |
| 30 |
implicit none |
| 31 |
integer :: i,j |
| 32 |
interface |
| 33 |
subroutine abort2 |
| 34 |
!GCC$ ATTRIBUTES noreturn :: abort2 |
| 35 |
end subroutine |
| 36 |
end interface |
| 37 |
call abort2() |
| 38 |
do i=1,j-1 ; end do ! { dg-bogus "is used uninitialized" "uninitialized" } |
| 39 |
end subroutine foo3 |
| 40 |
|
| 41 |
function foo4() |
| 42 |
integer :: foo4 |
| 43 |
!$GCC$ ATTRIBUTES noreturn :: foo4 |
| 44 |
foo4 = 1 |
| 45 |
end function |
| 46 |
|
| 47 |
subroutine foo5(k) |
| 48 |
implicit none |
| 49 |
integer :: i, k |
| 50 |
!GCC$ ATTRIBUTES noreturn :: mpi_abort |
| 51 |
call mpi_abort() |
| 52 |
k = i |
| 53 |
end subroutine |