https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71649

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #4)
> (In reply to jack.s...@nasa.gov from comment #2)
> 
> > >
> > > Could someone check that the problem is not darwin specific?
> > >
> 
> Not darwin specific. Is the sample code valid?

Of course the code is invalid.  Op has 

subroutine foo()
   implicit none
   i = foo()
end subroutine foo

1) Subroutines are not invoked as a function.
2) For a subroutine to invoke itself, it needs
   the recursive attribute.
3) Subroutines have no type.

Your patch is almost correct (IMO).  It should move
the check to the next conditional.

   if (tmp_symtree)
     {
       if (tmp_symtree->n.sym
           && tmp_symtree->n.sym->module
           && strcmp (modname, tmp_symtree->n.sym->module) == 0)
         return;

The error message shuold then be generated.

Reply via email to