diff options
author | Harald Anlauf <anlauf@gmx.de> | 2022-03-09 21:58:26 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2022-03-09 21:58:26 +0100 |
commit | 22015e77d3e45306077396b9de8a8a28bb67fb20 (patch) | |
tree | d667680b53824e538d8c58b0ad3ec1f7713337b7 /gcc/fortran/expr.cc | |
parent | e2607d71e5e371c0c006555e0531ea1ff5ac416c (diff) | |
download | gcc-22015e77d3e45306077396b9de8a8a28bb67fb20.zip gcc-22015e77d3e45306077396b9de8a8a28bb67fb20.tar.gz gcc-22015e77d3e45306077396b9de8a8a28bb67fb20.tar.bz2 |
Fortran: improve error recovery on invalid array section
gcc/fortran/ChangeLog:
PR fortran/104849
* expr.cc (find_array_section): Avoid NULL pointer dereference on
invalid array section.
gcc/testsuite/ChangeLog:
PR fortran/104849
* gfortran.dg/pr104849.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r-- | gcc/fortran/expr.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index c9c0ba4..86d61fe 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1594,7 +1594,9 @@ 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)) + || (step && step->expr_type != EXPR_CONSTANT) + || (!begin && !lower) + || (!finish && !upper)) { t = false; goto cleanup; |