diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-07-24 09:57:13 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-07-24 09:57:13 +0200 |
commit | 80927a562e1ec4a38a12f4b09b86f2f3ca9f253e (patch) | |
tree | 3a1ba521bd64c06116c292171eb8e9008c0f6c2b /libgfortran/libgfortran.h | |
parent | 3a802a9e6ddcf43f9c211b417f8435e3b63ce3cc (diff) | |
download | gcc-80927a562e1ec4a38a12f4b09b86f2f3ca9f253e.zip gcc-80927a562e1ec4a38a12f4b09b86f2f3ca9f253e.tar.gz gcc-80927a562e1ec4a38a12f4b09b86f2f3ca9f253e.tar.bz2 |
re PR fortran/40643 (maxloc/minloc: Wrong result for NaN at position 1)
PR fortran/40643
PR fortran/31067
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc,
gfc_conv_intrinsic_minmaxval): Handle Infinities and NaNs properly,
optimize.
* trans-array.c (gfc_trans_scalarized_loop_end): No longer static.
* trans-array.h (gfc_trans_scalarized_loop_end): New prototype.
* libgfortran.h (GFC_REAL_4_INFINITY, GFC_REAL_8_INFINITY,
GFC_REAL_10_INFINITY, GFC_REAL_16_INFINITY, GFC_REAL_4_QUIET_NAN,
GFC_REAL_8_QUIET_NAN, GFC_REAL_10_QUIET_NAN, GFC_REAL_16_QUIET_NAN):
Define.
* m4/iparm.m4 (atype_inf, atype_nan): Define.
* m4/ifunction.m4: Formatting.
* m4/iforeach.m4: Likewise.
(START_FOREACH_FUNCTION): Initialize dest to all 1s, not all 0s.
(START_FOREACH_BLOCK, FINISH_FOREACH_FUNCTION,
FINISH_MASKED_FOREACH_FUNCTION): Run foreach block inside a loop
until count[0] == extent[0].
* m4/minval.m4: Formatting. Handle NaNs and infinities. Optimize.
* m4/maxval.m4: Likewise.
* m4/minloc0.m4: Likewise.
* m4/maxloc0.m4: Likewise.
* m4/minloc1.m4: Likewise.
* m4/maxloc1.m4: Likewise.
* generated/maxloc0_16_i16.c: Regenerated.
* generated/maxloc0_16_i1.c: Likewise.
* generated/maxloc0_16_i2.c: Likewise.
* generated/maxloc0_16_i4.c: Likewise.
* generated/maxloc0_16_i8.c: Likewise.
* generated/maxloc0_16_r10.c: Likewise.
* generated/maxloc0_16_r16.c: Likewise.
* generated/maxloc0_16_r4.c: Likewise.
* generated/maxloc0_16_r8.c: Likewise.
* generated/maxloc0_4_i16.c: Likewise.
* generated/maxloc0_4_i1.c: Likewise.
* generated/maxloc0_4_i2.c: Likewise.
* generated/maxloc0_4_i4.c: Likewise.
* generated/maxloc0_4_i8.c: Likewise.
* generated/maxloc0_4_r10.c: Likewise.
* generated/maxloc0_4_r16.c: Likewise.
* generated/maxloc0_4_r4.c: Likewise.
* generated/maxloc0_4_r8.c: Likewise.
* generated/maxloc0_8_i16.c: Likewise.
* generated/maxloc0_8_i1.c: Likewise.
* generated/maxloc0_8_i2.c: Likewise.
* generated/maxloc0_8_i4.c: Likewise.
* generated/maxloc0_8_i8.c: Likewise.
* generated/maxloc0_8_r10.c: Likewise.
* generated/maxloc0_8_r16.c: Likewise.
* generated/maxloc0_8_r4.c: Likewise.
* generated/maxloc0_8_r8.c: Likewise.
* generated/maxloc1_16_i16.c: Likewise.
* generated/maxloc1_16_i1.c: Likewise.
* generated/maxloc1_16_i2.c: Likewise.
* generated/maxloc1_16_i4.c: Likewise.
* generated/maxloc1_16_i8.c: Likewise.
* generated/maxloc1_16_r10.c: Likewise.
* generated/maxloc1_16_r16.c: Likewise.
* generated/maxloc1_16_r4.c: Likewise.
* generated/maxloc1_16_r8.c: Likewise.
* generated/maxloc1_4_i16.c: Likewise.
* generated/maxloc1_4_i1.c: Likewise.
* generated/maxloc1_4_i2.c: Likewise.
* generated/maxloc1_4_i4.c: Likewise.
* generated/maxloc1_4_i8.c: Likewise.
* generated/maxloc1_4_r10.c: Likewise.
* generated/maxloc1_4_r16.c: Likewise.
* generated/maxloc1_4_r4.c: Likewise.
* generated/maxloc1_4_r8.c: Likewise.
* generated/maxloc1_8_i16.c: Likewise.
* generated/maxloc1_8_i1.c: Likewise.
* generated/maxloc1_8_i2.c: Likewise.
* generated/maxloc1_8_i4.c: Likewise.
* generated/maxloc1_8_i8.c: Likewise.
* generated/maxloc1_8_r10.c: Likewise.
* generated/maxloc1_8_r16.c: Likewise.
* generated/maxloc1_8_r4.c: Likewise.
* generated/maxloc1_8_r8.c: Likewise.
* generated/maxval_i16.c: Likewise.
* generated/maxval_i1.c: Likewise.
* generated/maxval_i2.c: Likewise.
* generated/maxval_i4.c: Likewise.
* generated/maxval_i8.c: Likewise.
* generated/maxval_r10.c: Likewise.
* generated/maxval_r16.c: Likewise.
* generated/maxval_r4.c: Likewise.
* generated/maxval_r8.c: Likewise.
* generated/minloc0_16_i16.c: Likewise.
* generated/minloc0_16_i1.c: Likewise.
* generated/minloc0_16_i2.c: Likewise.
* generated/minloc0_16_i4.c: Likewise.
* generated/minloc0_16_i8.c: Likewise.
* generated/minloc0_16_r10.c: Likewise.
* generated/minloc0_16_r16.c: Likewise.
* generated/minloc0_16_r4.c: Likewise.
* generated/minloc0_16_r8.c: Likewise.
* generated/minloc0_4_i16.c: Likewise.
* generated/minloc0_4_i1.c: Likewise.
* generated/minloc0_4_i2.c: Likewise.
* generated/minloc0_4_i4.c: Likewise.
* generated/minloc0_4_i8.c: Likewise.
* generated/minloc0_4_r10.c: Likewise.
* generated/minloc0_4_r16.c: Likewise.
* generated/minloc0_4_r4.c: Likewise.
* generated/minloc0_4_r8.c: Likewise.
* generated/minloc0_8_i16.c: Likewise.
* generated/minloc0_8_i1.c: Likewise.
* generated/minloc0_8_i2.c: Likewise.
* generated/minloc0_8_i4.c: Likewise.
* generated/minloc0_8_i8.c: Likewise.
* generated/minloc0_8_r10.c: Likewise.
* generated/minloc0_8_r16.c: Likewise.
* generated/minloc0_8_r4.c: Likewise.
* generated/minloc0_8_r8.c: Likewise.
* generated/minloc1_16_i16.c: Likewise.
* generated/minloc1_16_i1.c: Likewise.
* generated/minloc1_16_i2.c: Likewise.
* generated/minloc1_16_i4.c: Likewise.
* generated/minloc1_16_i8.c: Likewise.
* generated/minloc1_16_r10.c: Likewise.
* generated/minloc1_16_r16.c: Likewise.
* generated/minloc1_16_r4.c: Likewise.
* generated/minloc1_16_r8.c: Likewise.
* generated/minloc1_4_i16.c: Likewise.
* generated/minloc1_4_i1.c: Likewise.
* generated/minloc1_4_i2.c: Likewise.
* generated/minloc1_4_i4.c: Likewise.
* generated/minloc1_4_i8.c: Likewise.
* generated/minloc1_4_r10.c: Likewise.
* generated/minloc1_4_r16.c: Likewise.
* generated/minloc1_4_r4.c: Likewise.
* generated/minloc1_4_r8.c: Likewise.
* generated/minloc1_8_i16.c: Likewise.
* generated/minloc1_8_i1.c: Likewise.
* generated/minloc1_8_i2.c: Likewise.
* generated/minloc1_8_i4.c: Likewise.
* generated/minloc1_8_i8.c: Likewise.
* generated/minloc1_8_r10.c: Likewise.
* generated/minloc1_8_r16.c: Likewise.
* generated/minloc1_8_r4.c: Likewise.
* generated/minloc1_8_r8.c: Likewise.
* generated/minval_i16.c: Likewise.
* generated/minval_i1.c: Likewise.
* generated/minval_i2.c: Likewise.
* generated/minval_i4.c: Likewise.
* generated/minval_i8.c: Likewise.
* generated/minval_r10.c: Likewise.
* generated/minval_r16.c: Likewise.
* generated/minval_r4.c: Likewise.
* generated/minval_r8.c: Likewise.
* generated/product_c10.c: Likewise.
* generated/product_c16.c: Likewise.
* generated/product_c4.c: Likewise.
* generated/product_c8.c: Likewise.
* generated/product_i16.c: Likewise.
* generated/product_i1.c: Likewise.
* generated/product_i2.c: Likewise.
* generated/product_i4.c: Likewise.
* generated/product_i8.c: Likewise.
* generated/product_r10.c: Likewise.
* generated/product_r16.c: Likewise.
* generated/product_r4.c: Likewise.
* generated/product_r8.c: Likewise.
* generated/sum_c10.c: Likewise.
* generated/sum_c16.c: Likewise.
* generated/sum_c4.c: Likewise.
* generated/sum_c8.c: Likewise.
* generated/sum_i16.c: Likewise.
* generated/sum_i1.c: Likewise.
* generated/sum_i2.c: Likewise.
* generated/sum_i4.c: Likewise.
* generated/sum_i8.c: Likewise.
* generated/sum_r10.c: Likewise.
* generated/sum_r16.c: Likewise.
* generated/sum_r4.c: Likewise.
* generated/sum_r8.c: Likewise.
* gfortran.dg/maxlocval_2.f90: New test.
* gfortran.dg/maxlocval_3.f90: New test.
* gfortran.dg/maxlocval_4.f90: New test.
* gfortran.dg/minlocval_1.f90: New test.
* gfortran.dg/minlocval_2.f90: New test.
* gfortran.dg/minlocval_3.f90: New test.
* gfortran.dg/minlocval_4.f90: New test.
From-SVN: r150041
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r-- | libgfortran/libgfortran.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index acb02c4..a2e2002 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -294,6 +294,36 @@ internal_proto(big_endian); (GFC_INTEGER_16)((((GFC_UINTEGER_16)1) << 127) - 1) #endif +/* M{IN,AX}{LOC,VAL} need also infinities and NaNs if supported. */ + +#ifdef __FLT_HAS_INFINITY__ +# define GFC_REAL_4_INFINITY __builtin_inff () +#endif +#ifdef __DBL_HAS_INFINITY__ +# define GFC_REAL_8_INFINITY __builtin_inf () +#endif +#ifdef __LDBL_HAS_INFINITY__ +# ifdef HAVE_GFC_REAL_10 +# define GFC_REAL_10_INFINITY __builtin_infl () +# endif +# ifdef HAVE_GFC_REAL_16 +# define GFC_REAL_16_INFINITY __builtin_infl () +# endif +#endif +#ifdef __FLT_HAS_QUIET_NAN__ +# define GFC_REAL_4_QUIET_NAN __builtin_nanf ("") +#endif +#ifdef __DBL_HAS_QUIET_NAN__ +# define GFC_REAL_8_QUIET_NAN __builtin_nan ("") +#endif +#ifdef __LDBL_HAS_QUIET_NAN__ +# ifdef HAVE_GFC_REAL_10 +# define GFC_REAL_10_QUIET_NAN __builtin_nanl ("") +# endif +# ifdef HAVE_GFC_REAL_16 +# define GFC_REAL_16_QUIET_NAN __builtin_nanl ("") +# endif +#endif typedef struct descriptor_dimension { |