This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52413] Incorrect behavior of FRACTION when applied to a constant
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Jun 2013 13:15:20 +0000
- Subject: [Bug fortran/52413] Incorrect behavior of FRACTION when applied to a constant
- Auto-submitted: auto-generated
- References: <bug-52413-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52413
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Before going to the machinery in comment #6, the following patch (i.e., without
any mpfr_copysign)
--- ../_clean/gcc/fortran/simplify.c 2013-06-08 21:50:33.000000000 +0200
+++ gcc/fortran/simplify.c 2013-06-23 15:02:54.000000000 +0200
@@ -2351,7 +2351,7 @@ gfc_simplify_fraction (gfc_expr *x)
if (mpfr_sgn (x->value.real) == 0)
{
- mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
+ mpfr_set (result->value.real, x->value.real, GFC_RND_MODE);
return result;
}
@@ -2368,7 +2368,7 @@ gfc_simplify_fraction (gfc_expr *x)
mpfr_ui_pow (pow2, 2, exp, GFC_RND_MODE);
- mpfr_div (result->value.real, absv, pow2, GFC_RND_MODE);
+ mpfr_div (result->value.real, x->value.real, pow2, GFC_RND_MODE);
mpfr_clears (exp, absv, pow2, NULL);
passes my tests.