diff options
author | Harald Anlauf <anlauf@gmx.de> | 2023-01-18 22:13:29 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2023-01-19 19:12:55 +0100 |
commit | 117848f425a3c0eda85517b4bdaf2ebe3bc705c2 (patch) | |
tree | e9c69bfe8216f21010efea4bcd88ffce2eb3f59b /gcc/fortran/expr.cc | |
parent | f8cb07a7a445c61a704476746b971ddd967627aa (diff) | |
download | gcc-117848f425a3c0eda85517b4bdaf2ebe3bc705c2.zip gcc-117848f425a3c0eda85517b4bdaf2ebe3bc705c2.tar.gz gcc-117848f425a3c0eda85517b4bdaf2ebe3bc705c2.tar.bz2 |
Fortran: error recovery for invalid CLASS component [PR108434]
gcc/fortran/ChangeLog:
PR fortran/108434
* expr.cc (class_allocatable): Prevent NULL pointer dereference
or invalid read.
(class_pointer): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/108434
* gfortran.dg/pr108434.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r-- | gcc/fortran/expr.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 5ec369c..3036b1b 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -4996,14 +4996,14 @@ get_union_initializer (gfc_symbol *union_type, gfc_component **map_p) static bool class_allocatable (gfc_component *comp) { - return comp->ts.type == BT_CLASS && CLASS_DATA (comp) + return comp->ts.type == BT_CLASS && comp->attr.class_ok && CLASS_DATA (comp) && CLASS_DATA (comp)->attr.allocatable; } static bool class_pointer (gfc_component *comp) { - return comp->ts.type == BT_CLASS && CLASS_DATA (comp) + return comp->ts.type == BT_CLASS && comp->attr.class_ok && CLASS_DATA (comp) && CLASS_DATA (comp)->attr.pointer; } |