This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [fortran,patch] Call mpfr_check_range after setting emin/emax
- From: Tobias Burnus <burnus at net-b dot de>
- To: FX <fxcoudert at gmail dot com>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org patches" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 18 May 2008 20:34:48 +0200
- Subject: Re: [fortran,patch] Call mpfr_check_range after setting emin/emax
- References: <84CCC5DA-7F54-4CA8-8EB0-F676F5D945CF@gmail.com> <D1E70CA0-1EEE-4005-840E-99F02C93AC2F@gmail.com>
FX wrote:
The two patchlets below regtest fine on my system (x86_64-linux, both
-m32 and -m64) and fix the issue I am seeing with
gfortran.dg/nearest_4.f90. Is it OK to commit?
The arith.c part is OK. However, I wonder whether
@@ -2821,6 +2821,7 @@ gfc_simplify_nearest (gfc_expr *x, gfc_e
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);
shouldn't be rather
mpfr_set_emax ((mp_exp_t) gfc_real_kinds[kind].max_exponent - 1);
if (mpfr_sgn (s->value.real) > 0)
{
+ mpfr_check_range (result->value.real, 0, GMP_RNDU);
mpfr_nextabove (result->value.real);
mpfr_subnormalize (result->value.real, 0, GMP_RNDU);
}
else
{
+ mpfr_check_range (result->value.real, 0, GMP_RNDD);
mpfr_nextbelow (result->value.real);
mpfr_subnormalize (result->value.real, 0, GMP_RNDD);
}
But I have to admit that I have not thought much about this.
Tobias