Commit c2b2130c by Tobias Burnus

re PR libfortran/57496 (I/O: WRITE(*,*) HUGE(0._10) gives SIGFPE with -ffpe-trap=overflow)

2013-06-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57496
        * io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L,
        * ISFINITE,
        SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2,
        ISNAN2L, ISNAN): New macros.
        (output_float_FMT_G_,WRITE_FLOAT): Use them.

From-SVN: r199598
parent 7ddffc7f
2013-06-01 Tobias Burnus <burnus@net-b.de>
PR fortran/57496
* io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L, ISFINITE,
SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2, ISNAN2L,
ISNAN): New macros.
(output_float_FMT_G_,WRITE_FLOAT): Use them.
2013-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2013-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too. * acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too.
......
...@@ -961,6 +961,34 @@ __qmath_(quadmath_snprintf) (buffer, size, "%+-#.*Qf", \ ...@@ -961,6 +961,34 @@ __qmath_(quadmath_snprintf) (buffer, size, "%+-#.*Qf", \
#endif #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. /* 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 The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran
LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is: LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is:
...@@ -1127,7 +1155,7 @@ OUTPUT_FLOAT_FMT_G(16,L) ...@@ -1127,7 +1155,7 @@ OUTPUT_FLOAT_FMT_G(16,L)
{\ {\
GFC_REAL_ ## x tmp; \ GFC_REAL_ ## x tmp; \
tmp = * (GFC_REAL_ ## x *)source; \ tmp = * (GFC_REAL_ ## x *)source; \
if (isfinite (tmp)) \ if (ISFINITE (y,tmp)) \
nprinted = DTOA(y,0,tmp); \ nprinted = DTOA(y,0,tmp); \
else\ else\
nprinted = -1;\ nprinted = -1;\
...@@ -1194,10 +1222,10 @@ determine_en_precision (st_parameter_dt *dtp, const fnode *f, ...@@ -1194,10 +1222,10 @@ determine_en_precision (st_parameter_dt *dtp, const fnode *f,
{\ {\
GFC_REAL_ ## x tmp;\ GFC_REAL_ ## x tmp;\
tmp = * (GFC_REAL_ ## x *)source;\ tmp = * (GFC_REAL_ ## x *)source;\
sign_bit = signbit (tmp);\ sign_bit = SIGNBIT (y,tmp);\
if (!isfinite (tmp))\ if (!ISFINITE (y,tmp))\
{ \ { \
write_infnan (dtp, f, isnan (tmp), sign_bit);\ write_infnan (dtp, f, ISNAN (y,tmp), sign_bit);\
return;\ return;\
}\ }\
tmp = sign_bit ? -tmp : tmp;\ tmp = sign_bit ? -tmp : tmp;\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment