File nvl464739.patch of Package gcc43

Backported from FSF mainline:
	2009-01-06  Janis Johnson  <janis187@us.ibm.com>

gcc/
	* 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/
	* gcc.dg/dfp/decfloat-constants.c: Check for DECnn_SUBNORMAL_MIN
	instead of DECnn_DEN.  Support -DDBG to list lines that fail.

Index: gcc/ginclude/float.h
===================================================================
--- gcc/ginclude/float.h.orig	2009-11-20 13:52:02.000000000 +0100
+++ gcc/ginclude/float.h	2009-11-20 13:52:12.000000000 +0100
@@ -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
Index: gcc/real.c
===================================================================
--- gcc/real.c.orig	2009-10-19 13:18:20.000000000 +0200
+++ gcc/real.c	2009-11-20 13:52:12.000000000 +0100
@@ -4420,8 +4420,8 @@ const struct real_format decimal_single_
     10, 
     7,
     7,
-    -95,
-    96,
+    -94,
+    97,
     31,
     31,
     false,
@@ -4441,8 +4441,8 @@ const struct real_format decimal_double_
     10,
     16,
     16,
-    -383,
-    384,
+    -382,
+    385,
     63,
     63,
     false,
@@ -4462,8 +4462,8 @@ const struct real_format decimal_quad_fo
     10,
     34,
     34,
-    -6143,
-    6144,
+    -6142,
+    6145,
     127,
     127,
     false,
Index: gcc/c-cppbuiltin.c
===================================================================
--- gcc/c-cppbuiltin.c.orig	2008-08-21 13:36:55.000000000 +0200
+++ gcc/c-cppbuiltin.c	2009-11-20 13:52:12.000000000 +0100
@@ -280,7 +280,7 @@ builtin_define_decimal_float_constants (
 
   /* 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.  */
@@ -293,8 +293,9 @@ builtin_define_decimal_float_constants (
 	*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
@@ -303,8 +304,8 @@ builtin_define_decimal_float_constants (
   sprintf (buf, "1E-%d%s", fmt->p - 1, suffix);
   builtin_define_with_value (name, buf, 0);
 
-  /* Minimum denormalized postive decimal value.  */
-  sprintf (name, "__%s_DEN__", name_prefix);
+  /* Minimum subnormal postive decimal value.  */
+  sprintf (name, "__%s_SUBNORMAL_MIN__", name_prefix);
   p = buf;
   for (digits = fmt->p; digits > 1; digits--)
     {
@@ -313,7 +314,7 @@ builtin_define_decimal_float_constants (
 	*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);
 }
 
Index: gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
===================================================================
--- gcc/testsuite/gcc.dg/dfp/decfloat-constants.c.orig	2008-02-19 10:53:24.000000000 +0100
+++ gcc/testsuite/gcc.dg/dfp/decfloat-constants.c	2009-11-20 13:52:12.000000000 +0100
@@ -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_MIN_EXP != -95) abort();
-  if (DEC64_MIN_EXP != -383) abort();
-  if (DEC128_MIN_EXP != -6143) abort();
-
-  if (DEC32_MAX_EXP != 96) abort();
-  if (DEC64_MAX_EXP != 384) abort();
-  if (DEC128_MAX_EXP != 6144) abort();
-
-  if (DEC32_MAX != 9.999999E96DF) abort();
-  if (DEC64_MAX != 9.999999999999999E384DD) abort();
-  if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) abort();
-
-  if (DEC32_EPSILON != 1E-6DF) abort();
-  if (DEC64_EPSILON != 1E-15DD) abort();
-  if (DEC128_EPSILON != 1E-33DL) abort();
+  if (DEC32_MANT_DIG != 7) FAILURE
+  if (DEC64_MANT_DIG != 16) FAILURE
+  if (DEC128_MANT_DIG != 34) FAILURE
+
+  if (DEC32_MIN_EXP != -94) FAILURE
+  if (DEC64_MIN_EXP != -382) FAILURE
+  if (DEC128_MIN_EXP != -6142) FAILURE
+
+  if (DEC32_MAX_EXP != 97) FAILURE
+  if (DEC64_MAX_EXP != 385) FAILURE
+  if (DEC128_MAX_EXP != 6145) FAILURE
+
+  if (DEC32_MAX != 9.999999E96DF) FAILURE
+  if (DEC64_MAX != 9.999999999999999E384DD) FAILURE
+  if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) FAILURE
+
+  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_DEN != 0.000001E-95DF) abort();
-  if (DEC64_DEN != 0.000000000000001E-383DD) abort();
-  if (DEC128_DEN != 0.000000000000000000000000000000001E-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 (failcnt != 0)
+    abort ();
 
   return 0;
 }