aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/analyzer/pr93993.f90
blob: 8d5261c0eb904d882de952fdf1269cdf2c9e3667 (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
30
31
32
33
module np
  implicit none
  integer, parameter :: za = selected_real_kind(15, 307)
end module np

module gg
  use np

  type et(real_kind)
    integer, kind :: real_kind
  end type et

contains

  function hv (tm) result(ce)
    type (et(real_kind=za)), allocatable, target :: tm
    type (et(real_kind=za)), pointer :: ce

    allocate (tm) ! { dg-bogus "dereference of possibly-NULL" "" { xfail *-*-* } }
    ce => tm
  end function hv ! { dg-warning "leak of 'tm'" }

end module gg

program a5
  use np
  use gg
  implicit none
  type (et(real_kind=za)), allocatable :: qb
  type (et(real_kind=za)), pointer :: vt

  vt => hv (qb)
end program a5