1255376Sdes! { dg-do run }
2348980Sdes! { dg-options "-fdump-tree-original" }
3348980Sdes!
491100Sdes! PR 43969: [OOP] ALLOCATED() with polymorphic variables
591100Sdes!
691100Sdes! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
791100Sdes
891100Sdes
991100Sdesmodule foo_mod
10108794Sdes  type foo_inner
1191100Sdes    integer, allocatable :: v(:)
1295908Sdes  end type foo_inner
13117610Sdes  type foo_outer
1491100Sdes    class(foo_inner), allocatable :: int
1591100Sdes  end type foo_outer
1691100Sdescontains
17236109Sdessubroutine foo_checkit()
1891100Sdes  implicit none
1991100Sdes  type(foo_outer)    :: try
20115619Sdes  type(foo_outer),allocatable :: try2
2191100Sdes  class(foo_outer), allocatable :: try3
2291100Sdes  
23236109Sdes  if (allocated(try%int)) call abort()
2491100Sdes  allocate(foo_outer :: try3)
2591100Sdes  if (allocated(try3%int)) call abort()
26348980Sdes  allocate(try2)
27348980Sdes  if (allocated(try2%int)) call abort()
2891100Sdes 
2991100Sdesend subroutine foo_checkit
3091100Sdesend module foo_mod
3191100Sdes
3291100Sdes
3391100Sdesprogram main
34115619Sdes
3591100Sdes  use foo_mod
3691100Sdes  implicit none
3791100Sdes  
3891100Sdes  call foo_checkit()
39236109Sdes
4091100Sdesend program main
4191100Sdes
4291100Sdes! { dg-final { scan-tree-dump-times "__builtin_free" 12 "original" } }
43236109Sdes! { dg-final { cleanup-tree-dump "original" } }
44236109Sdes