PING! Re: [PATCH, Fortran] Extension: COTAN and degree-valued trig intrinsics with -fdec-math

Jerry DeLisle jvdelisle@charter.net
Tue Oct 11 18:10:00 GMT 2016


On 10/11/2016 09:32 AM, Aaron Sawdey wrote:
 > On Tue, 2016-10-11 at 07:26 -0400, Fritz Reese wrote:
 >> On Mon, Oct 10, 2016 at 3:56 PM, Steve Kargl
... snip ...
 >
 > I think the first part of that cleanup didn't get applied as I am
 > seeing this:
 >
 > ../../gcc/gcc/fortran/iresolve.c: In function âgfc_expr* get_degrees(gfc_expr*)â:
 > ../../gcc/gcc/fortran/iresolve.c:2728:14: error: âtmpâ was not declared in 
this scope
 >
 > and also this:
 >
 > ../../gcc/gcc/fortran/simplify.c: In function âvoid radians_f(__mpfr_struct*, 
mpfr_rnd_t)â:
 > ../../gcc/gcc/fortran/simplify.c:1775:5: error: âmpfr_fmod_dâ was not 
declared in this scope
 >      mpfr_fmod_d (tmp, x, 360.0, rnd_mode);
 >      ^~~~~~~~~~~
 >

This allows compilation. Still have to check if its the right result. --Jerry

diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index f4f81b2e..4334522c 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -2702,6 +2702,7 @@ get_degrees (gfc_expr *rad)
  {
    gfc_expr *result, *factor;
    gfc_actual_arglist *mod_args;
+  mpfr_t tmp;

    gcc_assert (rad->ts.type == BT_REAL);

diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index bf60f747..18135d2f 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -1768,11 +1768,13 @@ degrees_f (mpfr_t x, mp_rnd_t rnd_mode)
  static void
  radians_f (mpfr_t x, mp_rnd_t rnd_mode)
  {
-    mpfr_t tmp;
+    mpfr_t tmp, modtmp;
      mpfr_init (tmp);
+    mpfr_init (modtmp);

      /* Set x = x % 360 to avoid offsets with large angles.  */
-    mpfr_fmod_d (tmp, x, 360.0, rnd_mode);
+    mpfr_set_d (modtmp, 360.0, GFC_RND_MODE);
+    mpfr_fmod (tmp, x, modtmp, rnd_mode);

      /* Set x = x * pi.  */
      mpfr_const_pi (tmp, rnd_mode);
@@ -1782,6 +1784,7 @@ radians_f (mpfr_t x, mp_rnd_t rnd_mode)
      mpfr_div_d (x, x, 180.0, rnd_mode);

      mpfr_clear (tmp);
+    mpfr_clear (modtmp);
  }




More information about the Gcc-patches mailing list