[Bug fortran/55593] [4.8 Regression] Bogus error on passing DO LOOP variable

tkoenig at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 6 22:02:00 GMT 2012


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

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-12-06 22:02:01 UTC ---
(In reply to comment #1)
> From frontend-passes.c's doloop_code
> 
>     case EXEC_CALL:
>       f = co->symtree->n.sym->formal;
> 
> I think one should use in this case
>   co->value.function.esym
> 
> I believe co->value.function.* should always exist,

Not for a subroutine call ;-)

The following patch seems to work:

Index: frontend-passes.c
===================================================================
--- frontend-passes.c   (Revision 193793)
+++ frontend-passes.c   (Arbeitskopie)
@@ -1277,8 +1277,12 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTR
       break;

     case EXEC_CALL:
-      f = co->symtree->n.sym->formal;

+      if (co->resolved_sym == NULL)
+       break;
+
+      f = co->resolved_sym->formal;
+
       /* Withot a formal arglist, there is only unknown INTENT,
         which we don't check for.  */
       if (f == NULL)

> given that it comes after
> resolution (if not, the symtree can be used as fall back). In any case, one
> needs to be careful if it isn't an "isym" instead.

This is checked for in the code already.

I could not come up with a test case which fails for a function, so I don't
think this regression also applies to generic function calls.



More information about the Gcc-bugs mailing list