[Bug fortran/125866] [13/14/14/15/16/17 Regression] ICE: a module procedure with an allocatable, intent(out) derived-type array dummy

"tkoenig at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125866

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Jerry DeLisle from comment #4)
> (In reply to Steve Kargl from comment #3)
> > (In reply to Steve Kargl from comment #2)
> > > It's a null pointer dereference at expr:1197.
> > 
> > This fixes the issue.  Note, patch is against gcc 15 branch
> > do line numbers are off.
> > 
> > diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
> > index 04f0c513a7d..847066ce45a 100644
> > --- a/gcc/fortran/expr.cc
> > +++ b/gcc/fortran/expr.cc
> > @@ -1193,7 +1193,7 @@ is_CFI_desc (gfc_symbol *sym, gfc_expr *e)
> >        && e && e->expr_type == EXPR_VARIABLE)
> >      sym = e->symtree->n.sym;
> >  
> > -  if (sym && sym->attr.dummy
> > +  if (sym && sym->attr.dummy && sym->ns && sym->ns->proc_name
> >        && sym->ns->proc_name->attr.is_bind_c
> >        && (sym->attr.pointer
> >           || sym->attr.allocatable
> 
> Seems simple enough, I can commit for you if needed.

So, do you want to do the honors?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.