Hi all, attached a small patch that resolves the issues at least on x86_64-linux/F23.
- Andre On Tue, 11 Oct 2016 11:32:50 -0500 Aaron Sawdey <acsaw...@linux.vnet.ibm.com> wrote: > On Tue, 2016-10-11 at 07:26 -0400, Fritz Reese wrote: > > On Mon, Oct 10, 2016 at 3:56 PM, Steve Kargl > > <s...@troutmask.apl.washington.edu> wrote: > > ... > > > > > > There are a few small clean-up that can be > > > done. For example, > > > > > > +static gfc_expr * > > > +get_radians (gfc_expr *deg) > > > +{ > > > + mpfr_t tmp; > > ... > > > > > > the tmp variable is unneeded in the above. Converting the double > > > precision 180.0 to mpfr_t and then dividing is probably slower > > > than just dividing by 180. > > > > > > + /* Set factor = pi / 180. */ > > > + factor = gfc_get_constant_expr (deg->ts.type, deg->ts.kind, > > > °->where); > > > + mpfr_const_pi (factor->value.real, GFC_RND_MODE); > > > + mpfr_div_ui (factor->value.real, factor->value.real, 180, > > > GFC_RND_MODE); > > > > > ... > > > > Good catch, fixed and committed r240989. Many thanks to you and > > Jerry. > > > > --- > > Fritz Reese > > > > 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); > ^~~~~~~~~~~ > -- Andre Vehreschild * Email: vehre ad gmx dot de
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index f4f81b2..4334522 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 bf60f74..9204962 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, tmp2; mpfr_init (tmp); + mpfr_init (tmp2); /* Set x = x % 360 to avoid offsets with large angles. */ - mpfr_fmod_d (tmp, x, 360.0, rnd_mode); + mpfr_set_d (tmp2, 360.0, rnd_mode); + mpfr_fmod (tmp, x, tmp2, 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 (tmp2); }