| 1 |
module np |
| 2 |
implicit none |
| 3 |
integer, parameter :: za = selected_real_kind(15, 307) |
| 4 |
end module np |
| 5 |
|
| 6 |
module gg |
| 7 |
use np |
| 8 |
|
| 9 |
type et(real_kind) |
| 10 |
integer, kind :: real_kind |
| 11 |
end type et |
| 12 |
|
| 13 |
contains |
| 14 |
|
| 15 |
function hv (tm) result(ce) |
| 16 |
type (et(real_kind=za)), allocatable, target :: tm |
| 17 |
type (et(real_kind=za)), pointer :: ce |
| 18 |
|
| 19 |
allocate (tm) ! { dg-bogus "dereference of possibly-NULL" } |
| 20 |
ce => tm |
| 21 |
end function hv |
| 22 |
|
| 23 |
end module gg |
| 24 |
|
| 25 |
program a5 |
| 26 |
use np |
| 27 |
use gg |
| 28 |
implicit none |
| 29 |
type (et(real_kind=za)), allocatable :: qb |
| 30 |
type (et(real_kind=za)), pointer :: vt |
| 31 |
|
| 32 |
vt => hv (qb) |
| 33 |
end program a5 ! { dg-warning "leak of '.*qb'" } |