1! { dg-do run }
2! { dg-options "-O" }
3! Test the fix for PR29216 in which function results did not
4! get default initialization.
5! Contributed by Stephan Kramer  <stephan.kramer@imperial.ac.uk>
6!
7  type A
8    integer, pointer:: p => null ()
9    integer:: i=3
10  end type A
11  type(A):: x,y
12  if (associated(x%p) .or. x%i /= 3) call abort ()
13  x=f()
14  if (associated(x%p) .or. x%i /= 3) call abort ()
15  x=g()
16  if (associated(x%p) .or. x%i /= 3) call abort ()
17contains
18  function f() result (fr)
19    type(A):: fr
20    if (associated(fr%p) .or. fr%i /= 3) call abort ()
21  end function f
22  function g()
23    type(A):: g
24    if (associated(g%p) .or. g%i /= 3) call abort ()
25  end function g
26end
27