diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2014-10-19 20:49:27 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2014-10-19 20:49:27 +0000 |
commit | 565fad70aa35e354b628c5f94639e543a631e8e8 (patch) | |
tree | 39651a3e49d77383e3e4a37e968c07e84d8809ac /gcc/fortran/trans-const.c | |
parent | d856054bc7b4d494010234816bcb25e837eea3b1 (diff) | |
download | gcc-565fad70aa35e354b628c5f94639e543a631e8e8.zip gcc-565fad70aa35e354b628c5f94639e543a631e8e8.tar.gz gcc-565fad70aa35e354b628c5f94639e543a631e8e8.tar.bz2 |
re PR fortran/48979 (FRACTION und EXPONENT return invalid results for infinity/NaN)
PR fortran/48979
* trans-const.c (gfc_build_nan): New function.
* trans-const.h (gfc_build_nan): New prototype.
* trans-intrinsic.c (gfc_conv_intrinsic_exponent): Handle special
values.
(gfc_conv_intrinsic_minmaxval): Use gfc_build_nan.
(gfc_conv_intrinsic_fraction): Handle special values.
(gfc_conv_intrinsic_spacing): Likewise.
(gfc_conv_intrinsic_rrspacing): Likewise.
(gfc_conv_intrinsic_set_exponent): Likewise.
* gfortran.dg/ieee/intrinsics_2.F90: New test.
From-SVN: r216443
Diffstat (limited to 'gcc/fortran/trans-const.c')
-rw-r--r-- | gcc/fortran/trans-const.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 9135f29..99a1832 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -256,6 +256,16 @@ gfc_build_inf_or_huge (tree type, int kind) } } +/* Returns a floating-point NaN of a given type. */ + +tree +gfc_build_nan (tree type, const char *str) +{ + REAL_VALUE_TYPE real; + real_nan (&real, str, 1, TYPE_MODE (type)); + return build_real (type, real); +} + /* Converts a backend tree into a real constant. */ void |