aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-07-10 21:00:13 +0200
committerHarald Anlauf <anlauf@gmx.de>2020-07-10 21:00:13 +0200
commit8a0b69f0b089c05d233b8e1a941825b1ceac93bd (patch)
tree3e9ab99378053212e91fbd4877d2809ee3cd2b9a /gcc/fortran/match.c
parent2b6d99468d4d988fd5f5ea3e9be41a3dc95a1291 (diff)
downloadgcc-8a0b69f0b089c05d233b8e1a941825b1ceac93bd.zip
gcc-8a0b69f0b089c05d233b8e1a941825b1ceac93bd.tar.gz
gcc-8a0b69f0b089c05d233b8e1a941825b1ceac93bd.tar.bz2
PR fortran/96086 - ICE in gfc_match_select_rank, at fortran/match.c:6645
Handle NULL pointer dereference on SELECT RANK with an invalid assumed-rank array declaration. gcc/fortran/ PR fortran/96086 * match.c (gfc_match_select_rank): Catch NULL pointer dereference. * resolve.c (resolve_assoc_var): Catch NULL pointer dereference that may occur after an illegal declaration.
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 7d3711c..cb09c5f 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6647,7 +6647,8 @@ gfc_match_select_rank (void)
if (expr2->symtree)
{
sym2 = expr2->symtree->n.sym;
- as = sym2->ts.type == BT_CLASS ? CLASS_DATA (sym2)->as : sym2->as;
+ as = (sym2->ts.type == BT_CLASS
+ && CLASS_DATA (sym2)) ? CLASS_DATA (sym2)->as : sym2->as;
}
if (expr2->expr_type != EXPR_VARIABLE
@@ -6659,7 +6660,7 @@ gfc_match_select_rank (void)
goto cleanup;
}
- if (expr2->ts.type == BT_CLASS)
+ if (expr2->ts.type == BT_CLASS && CLASS_DATA (sym2))
{
copy_ts_from_selector_to_associate (expr1, expr2);