[Bug fortran/34868] ICE with -ff2c for function returning a complex number

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Feb 28 10:43:00 GMT 2008



------- Comment #9 from fxcoudert at gcc dot gnu dot org  2008-02-28 10:42 -------
(In reply to comment #8)
> There's more to it... using the "result" syntax for the function makes it fail
> even with my patch

That's because the result symbol is not marked with attr.always_explicit, only
the procedure symbol. I think it's more convenient to mark both:

Index: resolve.c
===================================================================
--- resolve.c   (revision 132611)
+++ resolve.c   (working copy)
@@ -106,7 +106,10 @@ resolve_formal_arglist (gfc_symbol *proc
   if (gfc_elemental (proc)
       || sym->attr.pointer || sym->attr.allocatable
       || (sym->as && sym->as->rank > 0))
-    proc->attr.always_explicit = 1;
+    {
+      proc->attr.always_explicit = 1;
+      sym->attr.always_explicit = 1;
+    }

   formal_arg_flag = 1;

@@ -187,7 +190,11 @@ resolve_formal_arglist (gfc_symbol *proc
       if ((sym->as && sym->as->rank > 0 && sym->as->type == AS_ASSUMED_SHAPE)
          || sym->attr.pointer || sym->attr.allocatable || sym->attr.target
          || sym->attr.optional)
-       proc->attr.always_explicit = 1;
+       {
+         proc->attr.always_explicit = 1;
+         if (proc->result)
+           proc->result->attr.always_explicit = 1;
+       }

       /* If the flavor is unknown at this point, it has to be a variable.
         A procedure specification would have already set the type.  */


-- 


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



More information about the Gcc-bugs mailing list