This is the mail archive of the gcc-patches@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]

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


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