diff options
author | Thomas König <tkoenig@gcc.gnu.org> | 2020-04-19 12:56:32 +0200 |
---|---|---|
committer | Thomas König <tkoenig@gcc.gnu.org> | 2020-04-19 12:56:32 +0200 |
commit | 4dc6437183aec5439b88b076315ad8f31794d24b (patch) | |
tree | 3006375e9d6885f006e2ca79e97a82785525b43b /gcc/fortran/simplify.c | |
parent | e1113ffbd619d0568fb3b37e9660d9e0ae7862f5 (diff) | |
download | gcc-4dc6437183aec5439b88b076315ad8f31794d24b.zip gcc-4dc6437183aec5439b88b076315ad8f31794d24b.tar.gz gcc-4dc6437183aec5439b88b076315ad8f31794d24b.tar.bz2 |
Fix PR fortran/93500, ICE on invalid.
Returning &gfc_bad_expr when simplifying bounds after a divisin by zero
happened results in the division by zero error actually reaching the user.
2020-04-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/93500
* resolve.c (resolve_operator): If both operands are
NULL, return false.
* simplify.c (simplify_bound): If a division by zero
was seen during bound simplification, free the
corresponcing expression and return &gfc_bad_expr.
2020-04-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/93500
* arith_divide_3.f90: New test.
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r-- | gcc/fortran/simplify.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index d5703e3..c7a4f77 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4251,7 +4251,11 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) for (j = 0; j < d; j++) gfc_free_expr (bounds[j]); - return bounds[d]; + + if (gfc_seen_div0) + return &gfc_bad_expr; + else + return bounds[d]; } } |