[Bug fortran/48979] FRACTION und EXPONENT return invalid results for infinity/NaN
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Thu May 12 21:11:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48979
--- Comment #10 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-05-12 20:54:38 UTC ---
Forgot the diff
Index: simplify.c
===================================================================
--- simplify.c (revision 173705)
+++ simplify.c (working copy)
@@ -2328,6 +2328,14 @@ gfc_simplify_fraction (gfc_expr *x)
result = gfc_get_constant_expr (BT_REAL, x->ts.kind, &x->where);
+ if (mpfr_nan_p (x->value.real) != 0 || mpfr_inf_p (x->value.real) != 0)
+ {
+ mpfr_set (result->value.real, x->value.real, GFC_RND_MODE);
+ if (gfc_option.allow_std & (GFC_STD_F2008|GFC_STD_F2003))
+ return result;
+ return range_check (result, "FRACTION");
+ }
+
if (mpfr_sgn (x->value.real) == 0)
{
mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
More information about the Gcc-bugs
mailing list