diff options
author | Harald Anlauf <anlauf@gmx.de> | 2022-10-19 22:37:56 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2022-10-20 22:19:01 +0200 |
commit | ecb20df4fa6d99daa635c7fb662dc0554610777e (patch) | |
tree | 423c38c5dc3d984f2409bc201e6383d49df06afb /gcc/fortran/expr.cc | |
parent | d155442de043c1bef7d27cf2d6be4eba618afcb9 (diff) | |
download | gcc-ecb20df4fa6d99daa635c7fb662dc0554610777e.zip gcc-ecb20df4fa6d99daa635c7fb662dc0554610777e.tar.gz gcc-ecb20df4fa6d99daa635c7fb662dc0554610777e.tar.bz2 |
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 <kargl@gcc.gnu.org>
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r-- | gcc/fortran/expr.cc | 10 |
1 files changed, 7 insertions, 3 deletions
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; |