diff mbox

Disable uninitialized warning with GCC 4.8

Message ID CA+5-Q5JS50ejoDyEwxV1B6zBoBi7AJ_ha3aQ=fyRh=RQ-vZU8w@mail.gmail.com
State New
Headers show

Commit Message

Stan Shebs Aug. 21, 2015, 9:41 p.m. UTC
As with other spots in the code, GCC 4.8 unnecessarily complains about
an uninitialized variable in tanl calcs, so this patch disables.  With
it, the library and sees the usual set of test passes.

Stan

        * sysdeps/ieee754/ldbl-96/k_tanl.c: Include <libc-internal.h>.
        (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

Comments

Joseph Myers Aug. 21, 2015, 10:38 p.m. UTC | #1
On Fri, 21 Aug 2015, Stan Shebs wrote:

> As with other spots in the code, GCC 4.8 unnecessarily complains about
> an uninitialized variable in tanl calcs, so this patch disables.  With
> it, the library and sees the usual set of test passes.
> 
> Stan
> 
>         * sysdeps/ieee754/ldbl-96/k_tanl.c: Include <libc-internal.h>.
>         (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

This patch doesn't apply cleanly, could you resend it as an attachment?
diff mbox

Patch

diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index ae6821d..b7f7869 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -57,6 +57,7 @@ 
  */

 #include <float.h>
+#include <libc-internal.h>
 #include <math.h>
 #include <math_private.h>
 static const long double
@@ -136,8 +137,19 @@  __kernel_tanl (long double x, long double y, int iy)
     {
       v = (long double) iy;
       w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+      /* SIGN is set for arguments that reach this code, but not
+        otherwise, resulting in warnings that it may be used
+        uninitialized although in the cases where it is used it has
+        always been set.  */
+      DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (4, 7)
+      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+#else
+      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wuninitialized");
+#endif
       if (sign < 0)
        w = -w;
+      DIAG_POP_NEEDS_COMMENT;
       return w;
     }
   if (iy == 1)