From ecb20df4fa6d99daa635c7fb662dc0554610777e Mon Sep 17 00:00:00 2001 From: Harald Anlauf Date: Wed, 19 Oct 2022 22:37:56 +0200 Subject: Fortran: error recovery with references of bad array constructors [PR105633] gcc/fortran/ChangeLog: PR fortran/105633 * expr.cc (find_array_section): Move check for NULL pointers so that both subscript triplets and vector subscripts are covered. gcc/testsuite/ChangeLog: PR fortran/105633 * gfortran.dg/pr105633.f90: New test. Co-authored-by: Steven G. Kargl --- gcc/fortran/expr.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 290ddf3..69d0b57 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1552,6 +1552,12 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) lower = ref->u.ar.as->lower[d]; upper = ref->u.ar.as->upper[d]; + if (!lower || !upper) + { + t = false; + goto cleanup; + } + if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR) /* Vector subscript. */ { gfc_constructor *ci; @@ -1594,9 +1600,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) { if ((begin && begin->expr_type != EXPR_CONSTANT) || (finish && finish->expr_type != EXPR_CONSTANT) - || (step && step->expr_type != EXPR_CONSTANT) - || !lower - || !upper) + || (step && step->expr_type != EXPR_CONSTANT)) { t = false; goto cleanup; -- cgit v1.1 From 47a6ae56584f5e3caaac74e158b77bf1c4fdd774 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 21 Oct 2022 00:17:52 +0000 Subject: Daily bump. --- gcc/fortran/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 80f12c6e..ab1810e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2022-10-20 Harald Anlauf + Steven G. Kargl + + PR fortran/105633 + * expr.cc (find_array_section): Move check for NULL pointers so + that both subscript triplets and vector subscripts are covered. + 2022-10-17 Steve Kargl PR fortran/104330 -- cgit v1.1