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

--- Comment #20 from Kyle Shores <kyle.shores44 at gmail dot com> ---
(In reply to Steve Kargl from comment #19)
> On Fri, Mar 08, 2024 at 05:42:05PM +0000, kyle.shores44 at gmail dot com
> wrote:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110644
> > 
> > --- Comment #17 from Kyle Shores <kyle.shores44 at gmail dot com> ---
> > I was able to get tuv-x to compile by putting use statements in problematic
> > files at the top of the module. In one case, I had to match the use 
> > ordering to
> > the order that the objects were used in the module (unsure if that 
> > mattered),
> > and I also removed an object in a use only statement that wasn't used in 
> > that
> > same file and then it compiled (these last two issues were for the same file
> > test/unit/radiator/from_host.F90)
> > 
> > 
> 
> 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

For example get_config_array:
https://github.com/NCAR/tuv-x/blob/6930151e3cd89189df4ec046fdf19c02300d4380/src/util/config.F90#L715-L754


Either way, this PR fixes the issue for gcc 13 be moving use statements around
https://github.com/NCAR/tuv-x/pull/53. The bug still exists in gcc 13, but for
anyone else who encounters this issue, they can try pulling use statements up
to the top of the module

Reply via email to