summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-06 19:02:41 +0000
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-06 19:02:41 +0000
commit0c87fb2bac12c51b593a6196dc17aa0b9a0aba7b (patch)
tree093f146d6705962c90265309fe92cd0dc9fd825e /gcc
parent710ab45a38393276b00bbd0d8650f9d4432ca21d (diff)
downloadgcc-0c87fb2bac12c51b593a6196dc17aa0b9a0aba7b.tar.gz
gcc/
PR c/34252 * ginclude/float.h: Rename DECnn_DEN to DECnn_SUBNORMAL_MIN. * real.c (decimal_single_format): Correct values of emin and emax. (decimal_double_format): Ditto. (decimal_quad_format): Ditto. * c-cppbuiltin.c (builtin_define_decimal_float_constants): Adjust computation of DECnn_MIN and DECnn_MAX for corrected values of emin and emax. Define __DECnn_SUBNORMAL_MIN__ instead of __DECnn_MIN__, and adjust its computation for the corrected value of emin. gcc/testsuite/ PR c/34252 * gcc.dg/dfp/decfloat-constants.c: Check for DECnn_SUBNORMAL_MIN instead of DECnn_DEN. Support -DDBG to list lines that fail. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143128 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/c-cppbuiltin.c15
-rw-r--r--gcc/ginclude/float.h16
-rw-r--r--gcc/real.c16
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/dfp/decfloat-constants.c56
6 files changed, 78 insertions, 44 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2690bd193aa..80fd4d09a91 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-06 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/34252
+ * ginclude/float.h: Rename DECnn_DEN to DECnn_SUBNORMAL_MIN.
+ * real.c (decimal_single_format): Correct values of emin and emax.
+ (decimal_double_format): Ditto.
+ (decimal_quad_format): Ditto.
+ * c-cppbuiltin.c (builtin_define_decimal_float_constants): Adjust
+ computation of DECnn_MIN and DECnn_MAX for corrected values of
+ emin and emax. Define __DECnn_SUBNORMAL_MIN__ instead of
+ __DECnn_MIN__, and adjust its computation for the corrected value
+ of emin.
+
2009-01-06 Jan Hubicka <jh@suse.cz>
PR target/38744
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index f1a454fed9a..58b1796e797 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -1,5 +1,5 @@
/* Define builtin-in macros for the C family front ends.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -279,7 +279,7 @@ builtin_define_decimal_float_constants (const char *name_prefix,
/* Compute the minimum representable value. */
sprintf (name, "__%s_MIN__", name_prefix);
- sprintf (buf, "1E%d%s", fmt->emin, suffix);
+ sprintf (buf, "1E%d%s", fmt->emin - 1, suffix);
builtin_define_with_value (name, buf, 0);
/* Compute the maximum representable value. */
@@ -292,8 +292,9 @@ builtin_define_decimal_float_constants (const char *name_prefix,
*p++ = '.';
}
*p = 0;
- /* fmt->p plus 1, to account for the decimal point. */
- sprintf (&buf[fmt->p + 1], "E%d%s", fmt->emax, suffix);
+ /* fmt->p plus 1, to account for the decimal point and fmt->emax
+ minus 1 because the digits are nines, not 1.0. */
+ sprintf (&buf[fmt->p + 1], "E%d%s", fmt->emax - 1, suffix);
builtin_define_with_value (name, buf, 0);
/* Compute epsilon (the difference between 1 and least value greater
@@ -302,8 +303,8 @@ builtin_define_decimal_float_constants (const char *name_prefix,
sprintf (buf, "1E-%d%s", fmt->p - 1, suffix);
builtin_define_with_value (name, buf, 0);
- /* Minimum denormalized positive decimal value. */
- sprintf (name, "__%s_DEN__", name_prefix);
+ /* Minimum subnormal positive decimal value. */
+ sprintf (name, "__%s_SUBNORMAL_MIN__", name_prefix);
p = buf;
for (digits = fmt->p; digits > 1; digits--)
{
@@ -312,7 +313,7 @@ builtin_define_decimal_float_constants (const char *name_prefix,
*p++ = '.';
}
*p = 0;
- sprintf (&buf[fmt->p], "1E%d%s", fmt->emin, suffix);
+ sprintf (&buf[fmt->p], "1E%d%s", fmt->emin - 1, suffix);
builtin_define_with_value (name, buf, 0);
}
diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
index 5d9f918e838..e6b1bfbb184 100644
--- a/gcc/ginclude/float.h
+++ b/gcc/ginclude/float.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
This file is part of GCC.
@@ -214,13 +214,13 @@ Boston, MA 02110-1301, USA. */
#define DEC64_MIN __DEC64_MIN__
#define DEC128_MIN __DEC128_MIN__
-/* Minimum denormalized positive floating-point number. */
-#undef DEC32_DEN
-#undef DEC64_DEN
-#undef DEC128_DEN
-#define DEC32_DEN __DEC32_DEN__
-#define DEC64_DEN __DEC64_DEN__
-#define DEC128_DEN __DEC128_DEN__
+/* Minimum subnormal positive floating-point number. */
+#undef DEC32_SUBNORMAL_MIN
+#undef DEC64_SUBNORMAL_MIN
+#undef DEC128_SUBNORMAL_MIN
+#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
+#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
+#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
/* The floating-point expression evaluation method.
-1 indeterminate
diff --git a/gcc/real.c b/gcc/real.c
index c5a16a867e1..d26b0cbd0c9 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1,6 +1,6 @@
/* real.c - software floating point emulation.
- Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
+ 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Stephen L. Moshier (moshier@world.std.com).
Re-written by Richard Henderson <rth@redhat.com>
@@ -4447,8 +4447,8 @@ const struct real_format decimal_single_format =
10,
7,
7,
- -95,
- 96,
+ -94,
+ 97,
31,
31,
false,
@@ -4469,8 +4469,8 @@ const struct real_format decimal_double_format =
10,
16,
16,
- -383,
- 384,
+ -382,
+ 385,
63,
63,
false,
@@ -4491,8 +4491,8 @@ const struct real_format decimal_quad_format =
10,
34,
34,
- -6143,
- 6144,
+ -6142,
+ 6145,
127,
127,
false,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c1ec07e9345..07c2de13e5a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-06 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/34252
+ * gcc.dg/dfp/decfloat-constants.c: Check for DECnn_SUBNORMAL_MIN
+ instead of DECnn_DEN. Support -DDBG to list lines that fail.
+
2009-01-06 Dominique Dhumieres <dominiq@lps.ens.fr>
* gfortran.dg/implicit_12.f90: Add space around dg directive.
diff --git a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
index 87c9849ac9b..ec9d3816706 100644
--- a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
+++ b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
@@ -14,36 +14,50 @@
#include <float.h>
extern void abort (void);
+static int failcnt;
+
+/* Support compiling the test to report individual failures; default is
+ to abort as soon as a check fails. */
+#ifdef DBG
+#include <stdio.h>
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
+#else
+#define FAILURE abort ();
+#endif
int main ()
{
- if (DEC32_MANT_DIG != 7) abort();
- if (DEC64_MANT_DIG != 16) abort();
- if (DEC128_MANT_DIG != 34) abort();
+ if (DEC32_MANT_DIG != 7) FAILURE
+ if (DEC64_MANT_DIG != 16) FAILURE
+ if (DEC128_MANT_DIG != 34) FAILURE
- if (DEC32_MIN_EXP != -95) abort();
- if (DEC64_MIN_EXP != -383) abort();
- if (DEC128_MIN_EXP != -6143) abort();
+ if (DEC32_MIN_EXP != -94) FAILURE
+ if (DEC64_MIN_EXP != -382) FAILURE
+ if (DEC128_MIN_EXP != -6142) FAILURE
- if (DEC32_MAX_EXP != 96) abort();
- if (DEC64_MAX_EXP != 384) abort();
- if (DEC128_MAX_EXP != 6144) abort();
+ if (DEC32_MAX_EXP != 97) FAILURE
+ if (DEC64_MAX_EXP != 385) FAILURE
+ if (DEC128_MAX_EXP != 6145) FAILURE
- if (DEC32_MAX != 9.999999E96DF) abort();
- if (DEC64_MAX != 9.999999999999999E384DD) abort();
- if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) abort();
+ if (DEC32_MAX != 9.999999E96DF) FAILURE
+ if (DEC64_MAX != 9.999999999999999E384DD) FAILURE
+ if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) FAILURE
- if (DEC32_EPSILON != 1E-6DF) abort();
- if (DEC64_EPSILON != 1E-15DD) abort();
- if (DEC128_EPSILON != 1E-33DL) abort();
+ if (DEC32_EPSILON != 1E-6DF) FAILURE
+ if (DEC64_EPSILON != 1E-15DD) FAILURE
+ if (DEC128_EPSILON != 1E-33DL) FAILURE
- if (DEC32_MIN != 1E-95DF) abort();
- if (DEC64_MIN != 1E-383DD) abort();
- if (DEC128_MIN != 1E-6143DL) abort();
+ if (DEC32_MIN != 1E-95DF) FAILURE
+ if (DEC64_MIN != 1E-383DD) FAILURE
+ if (DEC128_MIN != 1E-6143DL) FAILURE
+
+ if (DEC32_SUBNORMAL_MIN != 0.000001E-95DF) FAILURE
+ if (DEC64_SUBNORMAL_MIN != 0.000000000000001E-383DD) FAILURE
+ if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL)
+ FAILURE
- if (DEC32_DEN != 0.000001E-95DF) abort();
- if (DEC64_DEN != 0.000000000000001E-383DD) abort();
- if (DEC128_DEN != 0.000000000000000000000000000000001E-6143DL) abort();
+ if (failcnt != 0)
+ abort ();
return 0;
}