This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/52413] Incorrect behavior of FRACTION when applied to a constant


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]