Dead code in fortran/simplify.c

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dead code in fortran/simplify.c

Steve Kargl
Dead code is probably not the right description.
Something like 'result that is not used' is better.
In event, the patch removes 3 useless lines.
Please commit.

Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 280157)
+++ gcc/fortran/simplify.c (working copy)
@@ -1774,11 +1792,6 @@ degrees_f (mpfr_t x, mpfr_rnd_t rnd_mode)
 {
   mpfr_t tmp;
   mpfr_init (tmp);
-
-  /* Set x = x % 2pi to avoid offsets with large angles.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_mul_ui (tmp, tmp, 2, rnd_mode);
-  mpfr_fmod (tmp, x, tmp, rnd_mode);
 
   /* Set x = x * 180.  */
   mpfr_mul_ui (x, x, 180, rnd_mode);

--
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Dead code in fortran/simplify.c

Steve Kargl
On Tue, Feb 25, 2020 at 09:28:59AM +0100, Tobias Burnus wrote:
> Thanks for the cleanup. Committed (with "git commit --author 'St...'" + git
> push) as Rev. r10-6836-gfe86f537f010828b7f77ff459cef138e84071660
>

Thanks.

--
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Dead code in fortran/simplify.c

Fritz Reese
In fact it is a logic error that the code is not used, so the
preferred patch would be to fix it, rather than remove it...

That being said the solution to PR 93871
[https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871], which I plan to
attend to in the coming week(s), will likely touch and possibly
replace this code anyway.

---
Fritz Reese



On Tue, Feb 25, 2020 at 10:07 AM Steve Kargl
<[hidden email]> wrote:

>
> On Tue, Feb 25, 2020 at 09:28:59AM +0100, Tobias Burnus wrote:
> > Thanks for the cleanup. Committed (with "git commit --author 'St...'" + git
> > push) as Rev. r10-6836-gfe86f537f010828b7f77ff459cef138e84071660
> >
>
> Thanks.
>
> --
> Steve
Reply | Threaded
Open this post in threaded view
|

Re: Dead code in fortran/simplify.c

Steve Kargl
On Wed, Feb 26, 2020 at 01:51:48PM -0500, Fritz Reese wrote:
> In fact it is a logic error that the code is not used, so the
> preferred patch would be to fix it, rather than remove it...
>
> That being said the solution to PR 93871
> [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871], which I plan to
> attend to in the coming week(s), will likely touch and possibly
> replace this code anyway.

I posted a draft patch that replaces the current
implementation with one that brings it in line with how
gfortran handles all other intrinsic subprograms (except
for a few in IEEE_ARITHMETIC).  I've identified and fix
a few issues with that patch.  The patch takes what you
have done and essentially in-lines the degree trig functions
during conversion by trans-intrinsic.c.

The only missing feature in my WIP is better argument
reduction or transformations as suggested by Thomas.  I
can send you a diff later today if you would like to use
it as a starting point.

--
Steve