This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Functions returning arrays using wrong calling convention
- From: Paul Brook <paul at nowt dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>,fortran at gcc dot gnu dot org
- Date: Mon, 13 Oct 2003 23:40:27 +0100
- Subject: [gfortran] Functions returning arrays using wrong calling convention
We were missing the fact that a function returned an array when resolvind
module procedures. The lead to us using the wrong calling convention.
Patch below applied to tree-ssa branch.
Paul
2003-10-11 Paul Brook <paul@nowt.org>
* resolve.c (resolve_formal_arglist): Use function result decl in
preference to function decl.
testsuite
* gfortran.fortran-torture/execute/retarray_2.f90: New test.
--- clean/tree-ssa/gcc/fortran/resolve.c
+++ gcc/gcc/fortran/resolve.c
@@ -60,9 +60,14 @@ resolve_formal_arglist (gfc_symbol * pro
/* TODO: Procedures whose return character length parameter is not
constant
or assumed must also have explicit interfaces. */
+ if (proc->result != NULL)
+ sym = proc->result;
+ else
+ sym = proc;
+
if (gfc_elemental (proc)
- || proc->attr.pointer || proc->attr.allocatable
- || (proc->as && proc->as->rank > 0))
+ || sym->attr.pointer || sym->attr.allocatable
+ || (sym->as && sym->as->rank > 0))
proc->attr.always_explicit = 1;
for (f = proc->formal; f; f = f->next)