From: Harald Anlauf Date: Wed, 6 Jan 2021 18:37:11 +0000 (+0100) Subject: PR fortran/78746 - invalid access after error recovery X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b6f1e8f97fe0d435d334075821149dbd85c8266;p=gcc.git PR fortran/78746 - invalid access after error recovery The error recovery after an invalid reference to an undefined CLASS during a TYPE declaration lead to an invalid access. Add a check. gcc/fortran/ChangeLog: * resolve.c (resolve_component): Add check for valid CLASS reference before trying to access CLASS data. --- diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index fa6f756d285..1fac183e200 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -14384,7 +14384,7 @@ resolve_component (gfc_component *c, gfc_symbol *sym) /* F2008, C448. */ if (c->ts.type == BT_CLASS) { - if (CLASS_DATA (c)) + if (c->attr.class_ok && CLASS_DATA (c)) { attr = &(CLASS_DATA (c)->attr);