mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-07 11:33:45 +08:00
PR fortran/96381 - invalid read in gfc_find_derived_vtab
An invalid declaration of a CLASS instance can lead to an internal state with inconsistent attributes during parsing that needs to be handled with sufficient care when processing subsequent statements. Avoid a lookup of the vtab entry for such cases. gcc/fortran/ChangeLog: * class.c (gfc_find_vtab): Add check on attribute is_class.
This commit is contained in:
parent
4b24d500f4
commit
d816b0c144
@ -2906,7 +2906,9 @@ gfc_find_vtab (gfc_typespec *ts)
|
||||
case BT_DERIVED:
|
||||
return gfc_find_derived_vtab (ts->u.derived);
|
||||
case BT_CLASS:
|
||||
if (ts->u.derived->components && ts->u.derived->components->ts.u.derived)
|
||||
if (ts->u.derived->attr.is_class
|
||||
&& ts->u.derived->components
|
||||
&& ts->u.derived->components->ts.u.derived)
|
||||
return gfc_find_derived_vtab (ts->u.derived->components->ts.u.derived);
|
||||
else
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user