From ca4300857f06252b8968e856034a1f43f0f8b72e Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Tue, 25 Nov 2008 05:55:55 +0000 Subject: [PATCH] re PR fortran/37803 (Call mpfr_check_range after setting emin/emax) 2008-11-24 Jerry DeLisle PR fortran/37803 * arith.c (gfc_check_real_range): Add mpfr_check_range. * simplify.c (gfc_simplify_nearest): Add mpfr_check_range. From-SVN: r142187 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/arith.c | 1 + gcc/fortran/simplify.c | 1 + 3 files changed, 8 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5fe6e9e3e03..a698031dce2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-11-24 Jerry DeLisle + + PR fortran/37803 + * arith.c (gfc_check_real_range): Add mpfr_check_range. + * simplify.c (gfc_simplify_nearest): Add mpfr_check_range. + 2008-11-24 Mikael Morin PR fortran/38184 diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index c56be036e2f..7440be3a230 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -379,6 +379,7 @@ gfc_check_real_range (mpfr_t p, int kind) en = gfc_real_kinds[i].min_exponent - gfc_real_kinds[i].digits + 1; mpfr_set_emin ((mp_exp_t) en); mpfr_set_emax ((mp_exp_t) gfc_real_kinds[i].max_exponent); + mpfr_check_range (q, 0, GFC_RND_MODE); mpfr_subnormalize (q, 0, GFC_RND_MODE); /* Reset emin and emax. */ diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 7922bde6ff1..6904960eb94 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -2993,6 +2993,7 @@ gfc_simplify_nearest (gfc_expr *x, gfc_expr *s) mpfr_set_emin ((mp_exp_t) gfc_real_kinds[kind].min_exponent - mpfr_get_prec(result->value.real) + 1); mpfr_set_emax ((mp_exp_t) gfc_real_kinds[kind].max_exponent - 1); + mpfr_check_range (result->value.real, 0, GMP_RNDU); if (mpfr_sgn (s->value.real) > 0) {