public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument
Date: Sat, 17 Mar 2007 15:53:00 -0000	[thread overview]
Message-ID: <20070317155226.16528.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31200-6642@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2007-03-17 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 11:27 [Bug fortran/31200] New: wrong code generated with gfortran jv244 at cam dot ac dot uk
2007-03-16 14:07 ` [Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument burnus at gcc dot gnu dot org
2007-03-16 17:10 ` pault at gcc dot gnu dot org
2007-03-17 15:53 ` pault at gcc dot gnu dot org [this message]
2007-03-21 17:13 ` burnus at gcc dot gnu dot org
2007-03-24  8:10 ` patchapp at dberlin dot org
2007-03-24 12:31 ` pault at gcc dot gnu dot org
2007-03-24 13:58 ` pault at gcc dot gnu dot org
2007-03-24 14:18 ` pault at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070317155226.16528.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).