This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2007 15:52:26 -0000
- Subject: [Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument
- References: <bug-31200-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pault at gcc dot gnu dot org 2007-03-17 15:52 -------
This fixes the bug (and PR31209) and regtests OK. Will package it up as a
submission tomorrow morning.
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c (revision 122943)
--- gcc/fortran/trans-expr.c (working copy)
*************** gfc_conv_function_call (gfc_se * se, gfc
*** 2074,2083 ****
--- 2074,2091 ----
/* Argument list functions %VAL, %LOC and %REF are signalled
through arg->name. */
conv_arglist_function (&parmse, arg->expr, arg->name);
+ else if ((e->expr_type == EXPR_FUNCTION)
+ && e->symtree->n.sym->attr.pointer
+ && fsym && fsym->attr.target)
+ {
+ gfc_conv_expr (&parmse, e);
+ parmse.expr = build_fold_addr_expr (parmse.expr);
+ }
else
{
gfc_conv_expr_reference (&parmse, e);
if (fsym && fsym->attr.pointer
+ && fsym->attr.flavor != FL_PROCEDURE
&& e->expr_type != EXPR_NULL)
{
/* Scalar pointer dummy args require an extra level of
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31200