+2019-02-23 David Malcolm <dmalcolm@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/88074
+ * simplify.c (norm2_do_sqrt, gfc_simplify_norm2): Use
+ mpfr_number_p && !mpfr_zero_p instead of mpfr_regular_p.
+ (norm2_add_squared): Likewise. Use mp_exp_t rather than mpfr_exp_t.
+
2019-02-22 Harald Anlauf <anlauf@gmx.de>
PR fortran/83057
gfc_set_model_kind (result->ts.kind);
int index = gfc_validate_kind (BT_REAL, result->ts.kind, false);
- mpfr_exp_t exp;
- if (mpfr_regular_p (result->value.real))
+ mp_exp_t exp;
+ if (mpfr_number_p (result->value.real) && !mpfr_zero_p (result->value.real))
{
exp = mpfr_get_exp (result->value.real);
/* If result is getting close to overflowing, scale down. */
}
mpfr_init (tmp);
- if (mpfr_regular_p (e->value.real))
+ if (mpfr_number_p (e->value.real) && !mpfr_zero_p (e->value.real))
{
exp = mpfr_get_exp (e->value.real);
/* If e**2 would overflow or close to overflowing, scale down. */
if (result != e)
mpfr_set (result->value.real, e->value.real, GFC_RND_MODE);
mpfr_sqrt (result->value.real, result->value.real, GFC_RND_MODE);
- if (norm2_scale && mpfr_regular_p (result->value.real))
+ if (norm2_scale
+ && mpfr_number_p (result->value.real)
+ && !mpfr_zero_p (result->value.real))
{
mpfr_t tmp;
mpfr_init (tmp);
result = simplify_transformation_to_scalar (result, e, NULL,
norm2_add_squared);
mpfr_sqrt (result->value.real, result->value.real, GFC_RND_MODE);
- if (norm2_scale && mpfr_regular_p (result->value.real))
+ if (norm2_scale
+ && mpfr_number_p (result->value.real)
+ && !mpfr_zero_p (result->value.real))
{
mpfr_t tmp;
mpfr_init (tmp);