! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR 55603: [F03] Memory leak with scalar allocatable function result
!
! Contributed by Damian Rouson <damian@rouson.net>

  type foo
  end type
  type(foo) a
  a = bar()
contains
  function bar()
    type(foo), allocatable :: bar
    allocate(bar)
  end function
end

! { dg-final { scan-tree-dump-times "__builtin_free" 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
