https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88357
--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #1)
>
> Related non-coarray version :
>
>
> $ cat z3.f90
> program p
> type t
> end type
> class(t) :: x
> associate (y => x)
> end associate
> end
>
>
> $ gfortran-9-20181202 -c z3.f90
> z3.f90:4:16:
>
> 4 | class(t) :: x
> | 1
> Error: CLASS variable 'x' at (1) must be dummy, allocatable or pointer
> f951: internal compiler error: Segmentation fault
> 0xc8f33f crash_signal
> ../../gcc/toplev.c:326
> 0x6ab3c3 resolve_assoc_var
> ../../gcc/fortran/resolve.c:8718
Seems to be multiple bugs conflated into one report.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 266766)
+++ gcc/fortran/resolve.c (working copy)
@@ -8715,7 +8715,8 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_targe
{
/* target's rank is 0, but the type of the sym is still array valued,
which has to be corrected. */
- if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)
+ if (sym->ts.type == BT_CLASS
+ && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
{
gfc_array_spec *as;
symbol_attribute attr;