aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-06-28 16:24:15 +0200
committerHarald Anlauf <anlauf@gmx.de>2020-06-28 16:24:15 +0200
commitb62cac6d92ff251213753475b69ec0b269cb7fae (patch)
tree20f04a663bf0818890729cdd79e1dd2357cfb2df /gcc/fortran/match.c
parent06ed4aae1c2fa84b7050a286d866db4a6def3c36 (diff)
downloadgcc-b62cac6d92ff251213753475b69ec0b269cb7fae.zip
gcc-b62cac6d92ff251213753475b69ec0b269cb7fae.tar.gz
gcc-b62cac6d92ff251213753475b69ec0b269cb7fae.tar.bz2
PR fortran/95340 - ICE in gfc_match_select_rank, at fortran/match.c:6690
Do not dereference NULL pointer when querying array shape of possibly improperly delared variable. gcc/fortran/ PR fortran/95340 * match.c (gfc_match_select_rank): Do not dereference NULL pointer.
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index b011634..db5174f 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6695,7 +6695,8 @@ gfc_match_select_rank (void)
if (expr1->symtree)
{
sym = expr1->symtree->n.sym;
- as = sym->ts.type == BT_CLASS ? CLASS_DATA (sym)->as : sym->as;
+ as = (sym->ts.type == BT_CLASS
+ && CLASS_DATA (sym)) ? CLASS_DATA (sym)->as : sym->as;
}
if (expr1->expr_type != EXPR_VARIABLE