PR fortran/88379 - ICE with allocatable coarray, class and associate

Catch NULL pointer dereference for ASSOCIATE on allocatable coarray variable.

gcc/fortran/
	PR fortran/88379
	* resolve.c (resolve_assoc_var): Avoid NULL pointer dereference.
This commit is contained in:
Harald Anlauf 2020-06-30 23:36:56 +02:00
parent 31427b974e
commit 267f84c603
2 changed files with 12 additions and 1 deletions

View File

@ -9045,7 +9045,7 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target)
as = NULL;
sym->ts = *ts;
sym->ts.type = BT_CLASS;
attr = CLASS_DATA (sym)->attr;
attr = CLASS_DATA (sym) ? CLASS_DATA (sym)->attr : sym->attr;
attr.class_ok = 0;
attr.associate_var = 1;
attr.dimension = attr.codimension = 0;

View File

@ -0,0 +1,11 @@
! { dg-do compile }
! { dg-options "-fcoarray=single" }
! PR fortran/88379 - ICE with allocatable coarray, class and associate
program p
type t
end type t
class(t), allocatable :: x[:]
associate (y => x)
end associate
end