From 5cdf54b7654d7245f3f683d352184e6bd353063a Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Mon, 24 Aug 2015 16:31:47 +0000 Subject: [PATCH] re PR libfortran/57496 (I/O: WRITE(*,*) HUGE(0._10) gives SIGFPE with -ffpe-trap=overflow) PR libfortran/57496 * io/write_float.def: Use built-in type-generic functions defined by libgfortran.h for isfinite, isnan, and signbit. From-SVN: r227136 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/write_float.def | 35 ++++------------------------------ 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index b74b71d3c2f..9d58d50f289 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2015-08-24 Francois-Xavier Coudert + + PR libfortran/57496 + * io/write_float.def: Use built-in type-generic functions defined + by libgfortran.h for isfinite, isnan, and signbit. + 2015-08-23 Francois-Xavier Coudert PR libfortran/54572 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 1bbe0160619..dd298aa81ad 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -958,33 +958,6 @@ __qmath_(quadmath_snprintf) (buffer, size, "%+-#.*Qf", \ #endif -#if defined(GFC_REAL_16_IS_FLOAT128) -#define ISFINITE2Q(val) finiteq(val) -#endif -#define ISFINITE2(val) isfinite(val) -#define ISFINITE2L(val) isfinite(val) - -#define ISFINITE(suff,val) TOKENPASTE(ISFINITE2,suff)(val) - - -#if defined(GFC_REAL_16_IS_FLOAT128) -#define SIGNBIT2Q(val) signbitq(val) -#endif -#define SIGNBIT2(val) signbit(val) -#define SIGNBIT2L(val) signbit(val) - -#define SIGNBIT(suff,val) TOKENPASTE(SIGNBIT2,suff)(val) - - -#if defined(GFC_REAL_16_IS_FLOAT128) -#define ISNAN2Q(val) isnanq(val) -#endif -#define ISNAN2(val) isnan(val) -#define ISNAN2L(val) isnan(val) - -#define ISNAN(suff,val) TOKENPASTE(ISNAN2,suff)(val) - - /* Generate corresponding I/O format for FMT_G and output. The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran @@ -1164,7 +1137,7 @@ OUTPUT_FLOAT_FMT_G(16,L) {\ volatile GFC_REAL_ ## x tmp, one = 1.0;\ tmp = * (GFC_REAL_ ## x *)source;\ - if (ISFINITE (y,tmp))\ + if (isfinite (tmp))\ {\ nprinted = DTOA(y,0,tmp);\ int e = atoi (&buffer[4]);\ @@ -1235,10 +1208,10 @@ determine_en_precision (st_parameter_dt *dtp, const fnode *f, {\ GFC_REAL_ ## x tmp;\ tmp = * (GFC_REAL_ ## x *)source;\ - sign_bit = SIGNBIT (y,tmp);\ - if (!ISFINITE (y,tmp))\ + sign_bit = signbit (tmp);\ + if (!isfinite (tmp))\ { \ - write_infnan (dtp, f, ISNAN (y,tmp), sign_bit);\ + write_infnan (dtp, f, isnan (tmp), sign_bit);\ return;\ }\ tmp = sign_bit ? -tmp : tmp;\ -- 2.30.2