2 ! { dg-options "-Wtarget-lifetime" }
6 function f () result (ptr
)
7 integer, pointer :: ptr(:)
8 integer, allocatable
, target
:: a(:)
11 ptr
=> a
! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" }
17 integer, pointer :: ptr(:)
21 integer, target
:: tgt(5)
22 ptr
=> tgt
! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" }
27 integer, target
:: tgt
28 integer, pointer :: foo3
34 integer, pointer :: ptr
35 integer, target
:: tgt
39 integer, pointer :: p2
40 integer, target
:: tgt2
45 ptr
=> tgt2
! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" }