PATCH: [Fortran] Fix mpfr_lgamma call with mpfr 2.3.x (was: Gcc mainline is broken)

Tobias Burnus burnus@net-b.de
Mon Aug 27 10:13:00 GMT 2007


:ADDPATCH fortran:

John David Anglin wrote:
> Main is still broken for me:
>   
Seemingly, I made a mistake when trying GCC with mpfr-2.3.0svn and it
picked the system mpfr (2.2.1); additionally I possibly used the syntax
of mpfr_lngamma instead of mpfr_lgamma (at least the syntax is wrong).

The following works for me and -fdump-tree-original shows that the
simplification works & thus the right library is used:
   "print *, lgamma(1.0)"
shows the expected "static real8 C.1375 = 0.0;" (with mpfr 2.3.0svn).

Build on x86_64-unknown-linux-gnu with MPFR 2.3.0svn and the system MPFR
2.2.1 and regression tested.

Ok for the trunk?

Tobias

2007-08-27  Tobias Burnus  <burnus@net-b.de>

	* simplify.c (gfc_simplify_lgamma): Fix mpfr_lgamma call.

Index: simplify.c
===================================================================
--- simplify.c  (Revision 127825)
+++ simplify.c  (Arbeitskopie)
@@ -2235,6 +2235,7 @@ gfc_simplify_lgamma (gfc_expr *x __attri
 {
 #if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0)
   gfc_expr *result;
+  int sg;

   if (x->expr_type != EXPR_CONSTANT)
     return NULL;
@@ -2243,7 +2244,7 @@ gfc_simplify_lgamma (gfc_expr *x __attri

   gfc_set_model_kind (x->ts.kind);

-  mpfr_lgamma (result->value.real, x->value.real, GFC_RND_MODE);
+  mpfr_lgamma (result->value.real, &sg, x->value.real, GFC_RND_MODE);

   return range_check (result, "LGAMMA");
 #else



More information about the Fortran mailing list