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

--- Comment #21 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Mar 08, 2024 at 08:01:02PM +0000, kyle.shores44 at gmail dot com wrote:
> 
> (In reply to Steve Kargl from comment #19)
> > 
> > It seems your code is hitting a NULL pointer dereference when
> > generating a warning.  In resolve.cc(resolve_procedure_expression),
> > one finds
> > 
> >   /* A non-RECURSIVE procedure that is used as procedure expression within
> > its
> >      own body is in danger of being called recursively.  */
> >   if (is_illegal_recursion (sym, gfc_current_ns))
> >     gfc_warning (0, "Non-RECURSIVE procedure %qs at %L is possibly calling"
> >              " itself recursively.  Declare it RECURSIVE or use"
> >              " %<-frecursive%>", sym->name, &expr->where);
> > 
> > for whatever reason &expr->where is a NULL pointer.  If I change
> > the above to remove &expr->where, then your code compiles with 
> > a bunch of warningsi, e.g.,
> > 
> > [ 95%] Building Fortran object
> > test/oldtuv/CMakeFiles/oldphotolib.dir/util/la_srb.type.F90.o
> > /usr/home/sgk/tmp/tuv-x/test/oldtuv/util/la_srb.type.F90:873:28:
> > 
> >   873 |       end module la_srb_type
> >       |                            1
> > Warning: Non-RECURSIVE procedure 'get_config_array' at (1) is possibly
> > calling itself recursively.  Declare it RECURSIVE or use '-frecursive'
> >  
> > Unfortunately, without a much smaller example code, I cannot go
> > any further in debugging your problem.
> 
> Well that's odd, that function doesn't call itself recursively
>

If shuffling the USE statements around allows your code to
compile, then it is likely that gfortran cannot tell if
there is an indirect recursion.  gfortran tries to help
the user with a warning about **possible** recursion.  There
is likely an issue with how gfortran is searching namespaces,
but  

% find . -name \*.F90 | xargs wc -l | grep total
   96683 total
% find . -name \*.f90 | xargs wc -l | grep total
    4238 total

Chopping 100 kLOC to something that is managable is beyond
what I can do.

Reply via email to