This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52022] [4.5/4.6/4.7 Regression] Wrong-code with procedures passed as actual argument
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Jan 2012 17:24:42 +0000
- Subject: [Bug fortran/52022] [4.5/4.6/4.7 Regression] Wrong-code with procedures passed as actual argument
- Auto-submitted: auto-generated
- References: <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)))
{