2 ! { dg-options "-fdump-tree-original" }
4 ! PR 80983: [F03] memory leak when calling procedure-pointer component with allocatable result
6 ! Contributed by Janus Weil <janus@gcc.gnu.org>
12 procedure (alloc_integer
), pointer, nopass
:: alloc
15 procedure (alloc_integer
), pointer :: pp
17 type(concrete_type
) :: concrete
19 print *, alloc_integer() ! case #1: plain function
22 print *, pp() ! case #2: procedure pointer
24 concrete
% alloc
=> alloc_integer
25 print *, concrete
% alloc() ! case #3: procedure-pointer component
29 function alloc_integer() result(res
)
30 integer, allocatable
:: res
31 allocate(res
, source
=13)
36 ! { dg-final { scan-tree-dump-times "__builtin_free" 3 "original" } }