diff mbox

powerpc: Fix lgammal_r overflow warnings

Message ID 548898E1.2010208@linux.vnet.ibm.com
State New
Headers show

Commit Message

Adhemerval Zanella Dec. 10, 2014, 7:02 p.m. UTC
On 10-12-2014 16:54, Joseph Myers wrote:
> On Wed, 10 Dec 2014, Adhemerval Zanella wrote:
>
>> +/* ldbl-128ibm uses this file as is, however the MAXLGM and huge definition
>> +   overflows for IBM long double.  This directive prevents the overflow
>> +   warnings until IBM long double version is not fixed.  */
> The comment should refer to bug 16347.
>
> (huge is easy to fix - just include <float.h> and use LDBL_MAX, which will 
> be fine for both ldbl-128 and ldbl-128ibm.)
>
What about now:

--
	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Remove overflow warnings for
	constants definition.
--

Comments

Joseph Myers Dec. 10, 2014, 9:17 p.m. UTC | #1
On Wed, 10 Dec 2014, Adhemerval Zanella wrote:

> +static const long double huge = HUGE_VALL;

No, HUGE_VALL is not correct; that's infinity, which would lose the 
overflow exceptions and rounding-mode-dependent results.  (And the 
ChangeLog entry should name the variable whose initializer is being 
changed.)
diff mbox

Patch

diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
index 1961355..2124d62 100644
--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
@@ -70,12 +70,20 @@ 
 
 #include <math.h>
 #include <math_private.h>
+#include <libc-internal.h>
+#include <float.h>
 
+/* BZ#16347: ldbl-128ibm uses this file as is, however the MAXLGM
+   definition overflows for IBM long double.  This directive prevents the
+   overflow warnings until IBM long double version is not fixed.  */
 static const long double PIL = 3.1415926535897932384626433832795028841972E0L;
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
 static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
+DIAG_POP_NEEDS_COMMENT;
 static const long double one = 1.0L;
 static const long double zero = 0.0L;
-static const long double huge = 1.0e4000L;
+static const long double huge = HUGE_VALL;
 
 /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
    1/x <= 0.0741 (x >= 13.495...)