aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/func_result_1.f90
blob: 51f5cd4ca9ee96a31e598c639843237fdb0d9f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
! { dg-do run }
! From PR 19673 : We didn't dereference the result from POINTER
! functions with a RESULT clause
program ret_ptr
  if (foo(99) /= bar(99)) call abort ()
contains
  function foo (arg) result(ptr)
    integer :: arg
    integer, pointer :: ptr
    allocate (ptr)
    ptr = arg
  end function foo
  function bar (arg)
    integer :: arg
    integer, pointer :: bar
    allocate (bar)
    bar = arg
  end function bar
end  program ret_ptr