This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/48979] FRACTION und EXPONENT return invalid results for infinity/NaN
- From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 May 2011 21:09:26 +0000
- Subject: [Bug fortran/48979] FRACTION und EXPONENT return invalid results for infinity/NaN
- Auto-submitted: auto-generated
- References: <bug-48979-4@http.gcc.gnu.org/bugzilla/>
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);