diff options
author | Harald Anlauf <anlauf@gmx.de> | 2020-05-18 20:27:29 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2020-05-18 20:27:29 +0200 |
commit | e5abd1cb9160619721336ed800779a01548231f1 (patch) | |
tree | 074aab3a0818e1397808b016439d56afc5ac9125 /gcc/fortran/arith.c | |
parent | 2c832ffedf06ff614fc36c44ab6c892d84075e08 (diff) | |
download | gcc-e5abd1cb9160619721336ed800779a01548231f1.zip gcc-e5abd1cb9160619721336ed800779a01548231f1.tar.gz gcc-e5abd1cb9160619721336ed800779a01548231f1.tar.bz2 |
PR fortran/95053 - division by zero constants
Partially revert the fix for PR93499. Replace by checks for valid
expressions in the declaration of array shape and PDT KIND and LEN
expressions at a later stage.
gcc/fortran/
2020-05-18 Harald Anlauf <anlauf@gmx.de>
PR fortran/95053
* arith.c (gfc_divide): Revert hunk introduced by patch for
PR93499.
* decl.c (variable_decl): Generate error for array shape not being
an INTEGER constant.
(gfc_get_pdt_instance): Generate error if KIND or LEN expressions
in declaration of a PDT instance do not simplify to INTEGER
constants.
gcc/testsuite/
2020-05-18 Harald Anlauf <anlauf@gmx.de>
PR fortran/95053
* gfortran.dg/dec_structure_23.f90: Adjust to new error messages.
* gfortran.dg/pr93499.f90: Adjust to new error messages.
* gfortran.dg/pr95053_2.f90: New test.
* gfortran.dg/pr95053_3.f90: New test.
Diffstat (limited to 'gcc/fortran/arith.c')
-rw-r--r-- | gcc/fortran/arith.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index dd72f44..c770569 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -1806,38 +1806,6 @@ gfc_multiply (gfc_expr *op1, gfc_expr *op2) gfc_expr * gfc_divide (gfc_expr *op1, gfc_expr *op2) { - if (op2 && op2->expr_type == EXPR_CONSTANT) - { - arith rc = ARITH_OK; - switch (op2->ts.type) - { - case BT_INTEGER: - /* non-integer divided by integer 0 is handled elsewhere. */ - if (mpz_sgn (op2->value.integer) == 0 - && op1->ts.type == BT_INTEGER) - rc = ARITH_DIV0; - break; - case BT_REAL: - if (mpfr_sgn (op2->value.real) == 0 - && flag_range_check == 1) - rc = ARITH_DIV0; - break; - case BT_COMPLEX: - if (mpc_cmp_si_si (op2->value.complex, 0, 0) == 0 - && flag_range_check == 1) - rc = ARITH_DIV0; - break; - default: - /* basic type is non-numeric, handle this elsewhere. */ - break; - } - if (rc == ARITH_DIV0) - { - gfc_seen_div0 = true; - gfc_error ("Division by zero at %L", &op2->where); - return NULL; - } - } return eval_intrinsic_f3 (INTRINSIC_DIVIDE, gfc_arith_divide, op1, op2); } |