When declaring a polymorphic variable that is not a dummy, allocatable or
pointer, an ICE occurred due to a NULL pointer dereference. Check for
that situation and punt.
gcc/fortran/
PR fortran/93337
* class.c (gfc_find_derived_vtab): Punt if name is not set.
if (!derived)
return NULL;
+ if (!derived->name)
+ return NULL;
+
/* Find the gsymbol for the module of use associated derived types. */
if ((derived->attr.use_assoc || derived->attr.used_in_submodule)
&& !derived->attr.vtype && !derived->attr.is_class)
--- /dev/null
+! { dg-do compile }
+! PR fortran/93337 - ICE in gfc_dt_upper_string, at fortran/module.c:441
+
+program p
+ type t
+ character(:), allocatable :: a
+ end type t
+ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
+ x = x ! { dg-error "must not be polymorphic in intrinsic assignment" }
+end