diff options
author | Steven G. Kargl <kargls@comcast.net> | 2005-04-07 18:26:37 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-04-07 18:26:37 +0000 |
commit | 01ae893012ce58112229ac1e3bd1050d5afec72b (patch) | |
tree | 27d6b666571261da74732c902515eb5906f5a39d | |
parent | 03359b57f439670c05cc0050690884e1ac03bca4 (diff) | |
download | gcc-01ae893012ce58112229ac1e3bd1050d5afec72b.tar.gz |
simplify.c (gfc_simplify_exponent): Fix exponent(tiny(x))
From-SVN: r97792
-rw-r--r-- | gcc/fortran/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d7cbdc0f16e..e114853a20a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2005-04-07 Steven G. Kargl <kargls@comcast.net> + + * simplify.c (gfc_simplify_exponent): Fix exponent(tiny(x)) + 2005-04-06 Steven G. Kargl <kargls@comcast.net> * invoke.texi: Remove documentation of -std=f90 diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index c2117148839..add391f195e 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -967,6 +967,7 @@ gfc_simplify_exp (gfc_expr * x) gfc_expr * gfc_simplify_exponent (gfc_expr * x) { + int i; mpfr_t tmp; gfc_expr *result; @@ -991,6 +992,12 @@ gfc_simplify_exponent (gfc_expr * x) gfc_mpfr_to_mpz (result->value.integer, tmp); + /* The model number for tiny(x) is b**(emin - 1) where b is the base and emin + is the smallest exponent value. So, we need to add 1 if x is tiny(x). */ + i = gfc_validate_kind (x->ts.type, x->ts.kind, false); + if (mpfr_cmp (x->value.real, gfc_real_kinds[i].tiny) == 0) + mpz_add_ui (result->value.integer,result->value.integer, 1); + mpfr_clear (tmp); return range_check (result, "EXPONENT"); |