Avoid NULL pointer dereference.
gcc/fortran/
PR fortran/95881
* resolve.c (resolve_symbol): Avoid NULL pointer dereference.
if (flag_coarray == GFC_FCOARRAY_LIB && sym->ts.type == BT_CLASS
&& sym->ts.u.derived && CLASS_DATA (sym)
&& CLASS_DATA (sym)->attr.codimension
+ && CLASS_DATA (sym)->ts.u.derived
&& (CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp
|| CLASS_DATA (sym)->ts.u.derived->attr.pointer_comp))
{
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/95881 - ICE in resolve_symbol, at fortran/resolve.c:15175
+
+program p
+ type t
+ real, allocatable :: a[:]
+ end type t
+ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
+ allocate (x%a[*])
+end