public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/52022] [4.5/4.6/4.7 Regression] Wrong-code with procedures passed as actual argument
Date: Fri, 27 Jan 2012 18:05:00 -0000	[thread overview]
Message-ID: <bug-52022-4-wqckr9vDCL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52022-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52022

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org
   Target Milestone|---                         |4.5.4

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-27 17:24:42 UTC ---
The issue is seemingly a side effect of supporting proc-pointer returning
functions (a GCC 4.5 features).

This does not interact well with passing nonprocedure-pointer functions, that
return allocatables, as can be seen from the following chunk in trans-expr.c's
gfc_conv_procedure_call:

                  if (fsym && e->expr_type != EXPR_NULL
                      && ((fsym->attr.pointer
                           && fsym->attr.flavor != FL_PROCEDURE)
                          || (fsym->attr.proc_pointer
                              && !(e->expr_type == EXPR_VARIABLE
                                   && e->symtree->n.sym->attr.dummy))
                          || (fsym->attr.proc_pointer
                              && e->expr_type == EXPR_VARIABLE
                              && gfc_is_proc_ptr_comp (e, NULL))
                          || fsym->attr.allocatable))

Untested patch: Do the same as we already do for pointers.

--- trans-expr.c        (revision 183625)
+++ trans-expr.c        (working copy)
@@ -3664,3 +3664,4 @@ gfc_conv_procedure_call (gfc_se * se, gf
                              && gfc_is_proc_ptr_comp (e, NULL))
-                         || fsym->attr.allocatable))
+                         || (fsym->attr.allocatable
+                             && fsym->attr.flavor != FL_PROCEDURE)))
                    {


  reply	other threads:[~2012-01-27 17:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 17:54 [Bug fortran/52022] New: " burnus at gcc dot gnu.org
2012-01-27 18:05 ` burnus at gcc dot gnu.org [this message]
2012-01-27 20:43 ` [Bug fortran/52022] " burnus at gcc dot gnu.org
2012-01-27 21:07 ` jakub at gcc dot gnu.org
2012-01-28 11:00 ` burnus at gcc dot gnu.org
2012-01-28 11:41 ` burnus at gcc dot gnu.org
2012-01-28 11:55 ` burnus at gcc dot gnu.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=bug-52022-4-wqckr9vDCL@http.gcc.gnu.org/bugzilla/ \
    --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).