This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]