aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
blob: 9113a885fa6b4f4b0e511815ee12dbd0201f77ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
! { dg-do compile }
! { dg-options "-Wall" }
!
! PR fortran/55476
!
! Contribued by  Janus Weil
!
subroutine test
  integer, pointer :: p
  integer, target :: t
  p => t
contains
  subroutine sub()
    if (p /= 0) return
  end subroutine
end subroutine

module m
  integer, pointer :: p2
contains
  subroutine test
    integer, target :: t2
    p2 => t2 ! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" }
  contains
    subroutine sub()
      if (p2 /= 0) return
    end subroutine
  end subroutine
end module m