-Steven G. Kargl <kargls@comcast.net>
+2005-03-04 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR fortran/19673
+ * trans-expr.c (gfc_conv_function_call): Correctly dereference
+ argument from a pointer function also if it has a result clause.
+
+2005-03-04 Steven G. Kargl <kargls@comcast.net>
* expr.c (gfc_copy_shape_excluding): Change && to ||.
something like
x = f()
where f is pointer valued, we have to dereference the result. */
- if (sym->attr.pointer && !se->want_pointer && !byref)
+ if (!se->want_pointer && !byref
+ && (sym->attr.pointer || (sym->result && sym->result->attr.pointer)))
se->expr = gfc_build_indirect_ref (se->expr);
/* A pure function may still have side-effects - it may modify its
+2005-03-04 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR fortran/19673
+ * gfortran.dg/func_result_1.f90: New test.
+
2005-03-04 Ben Elliston <bje@au.ibm.com>
* gcc.misc-tests/options.exp: New test.
--- /dev/null
+! { dg-do run }
+! From PR 19673 : We didn't dereference the 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