[Bug fortran/81160] arith.c:2009: bad statement order ?

2017-06-27 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

Jerry DeLisle  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jerry DeLisle  ---
Closing

[Bug fortran/81160] arith.c:2009: bad statement order ?

2017-06-24 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

--- Comment #3 from Jerry DeLisle  ---
Fixed on trunk. Any need to backport to 7 or earlier?

[Bug fortran/81160] arith.c:2009: bad statement order ?

2017-06-24 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

--- Comment #2 from Jerry DeLisle  ---
Author: jvdelisle
Date: Sat Jun 24 21:22:08 2017
New Revision: 249627

URL: https://gcc.gnu.org/viewcvs?rev=249627=gcc=rev
Log:
2017-06-24  Jerry DeLisle  

PR fortran/81160
* arith.c (wprecision_int_real): Set return value before
mpz_clear and then return after it.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/arith.c

[Bug fortran/81160] arith.c:2009: bad statement order ?

2017-06-21 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

Jerry DeLisle  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-06-21
 CC||jvdelisle at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jvdelisle at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jerry DeLisle  ---
We probably should do:

static bool
wprecision_int_real (mpz_t n, mpfr_t r)
{
  bool result;
  mpz_t i;
  mpz_init (i);
  mpfr_get_z (i, r, GFC_RND_MODE);
  mpz_sub (i, i, n);
  result = mpz_cmp_si (i, 0) != 0;
  mpz_clear (i);
  return result;
}

I will check this further.