[gcc r9-9162] PR fortran/78746 - invalid access after error recovery
Harald Anlauf
anlauf@gcc.gnu.org
Thu Jan 7 19:33:33 GMT 2021
https://gcc.gnu.org/g:ef7d053ea33cc9abc7fc413213705a16478fefc4
commit r9-9162-gef7d053ea33cc9abc7fc413213705a16478fefc4
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Jan 6 19:37:11 2021 +0100
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.
(cherry picked from commit 8b6f1e8f97fe0d435d334075821149dbd85c8266)
Diff:
---
gcc/fortran/resolve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index aa27cb206a1..8ddef4f682b 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13974,7 +13974,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);
More information about the Gcc-cvs
mailing list