view gcc/testsuite/gfortran.dg/func_result_1.f90 @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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)) STOP 1
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