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

--- Comment #3 from Steve Kargl <kargl at gcc dot gnu.org> ---
(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

Reply via email to