2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / warn_target_lifetime_3.f90
blob6c8ea5b945834126a88b46704b2f3729ad6c1869
1 ! { dg-do compile }
2 ! { dg-options "-Wall" }
4 ! PR fortran/55476
6 ! Contribued by Janus Weil
8 subroutine test
9 integer, pointer :: p
10 integer, target :: t
11 p => t
12 contains
13 subroutine sub() ! { dg-warning "defined but not used" }
14 if (p /= 0) return
15 end subroutine
16 end subroutine
18 module m
19 integer, pointer :: p2
20 contains
21 subroutine test
22 integer, target :: t2
23 p2 => t2 ! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" }
24 contains
25 subroutine sub() ! { dg-warning "defined but not used" }
26 if (p2 /= 0) return
27 end subroutine
28 end subroutine
29 end module m