From patchwork Sat Sep 29 10:46:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jansa X-Patchwork-Id: 29581 Received: (qmail 91466 invoked by alias); 29 Sep 2018 10:46:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 91457 invoked by uid 89); 29 Sep 2018 10:46:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WnkTnfHfbDV7i+XGBPz1oU/nPW8q547kjet17l/k+Ag=; b=gpdvllARJMdSTRIA83APu4Ng5ozVM3PEnoDU/h52Q4x27Dml/Q+nn4CfTaSf31ZO4v loj0CyYKxH0Cy9LaGCOZEvyCR8KHSBGBh224i2ewuAbT2vXDo3Ja6+WrZquFw+t48pjj KWy668eBa4NRr8w2WvZOncZNyqEzBAJdoLabbKCODMLxTWjurH5adkhfbavbFBEme4Ya HR1EFv+ibRwsVC0GkDpKsHIGwiR6mvo/1snviY55J4WC+6DHrYcZYkgLFezNbOvuDUSv ukIvMGMubkbCgq9LQQImESS2Mzj7N8naXOfENaswH986lPKK6/9g7lQShUPSUGC9QUTO TT/Q== Return-Path: From: Martin Jansa To: libc-alpha@sourceware.org Cc: Martin Jansa Subject: [PATCHv2] sysdeps/ieee754: prevent maybe-uninitialized errors [BZ #19444] Date: Sat, 29 Sep 2018 10:46:07 +0000 Message-Id: <20180929104607.8121-1-Martin.Jansa@gmail.com> In-Reply-To: References: With -O included in CFLAGS it fails to build with: ../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl': ../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] b = invsqrtpi * temp / sqrtl (x); ~~~~~~~~~~^~~~~~ ../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl': ../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] b = invsqrtpi * temp / sqrtl (x); ~~~~~~~~~~^~~~~~ [BZ #23716] * sysdeps/ieee754/ldbl-96/e_jnl.c: Fix build with -O Signed-off-by: Martin Jansa --- ChangeLog | 4 ++++ sysdeps/ieee754/ldbl-96/e_jnl.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 07760299e6..5066a4840d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-09-29 Martin Jansa + Partial fix for [BZ #23716] + * sysdeps/ieee754/ldbl-96/e_jnl.c: Fix build with -O + 2018-09-28 Joseph Myers * math/fromfp.h: Do not include . diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c index 855190841b..c5b27e7fcf 100644 --- a/sysdeps/ieee754/ldbl-96/e_jnl.c +++ b/sysdeps/ieee754/ldbl-96/e_jnl.c @@ -62,6 +62,7 @@ #include #include #include +#include static const long double invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L; @@ -144,7 +145,14 @@ __ieee754_jnl (int n, long double x) temp = c - s; break; } +/* With GCC 8 when compiling with -O the compiler + warns that the variable 'temp', may be used uninitialized. + The switch above should cover all possible values of n & 3 + so I belive it's false possitive. */ +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); b = invsqrtpi * temp / sqrtl (x); +DIAG_POP_NEEDS_COMMENT; } else { @@ -373,7 +381,14 @@ __ieee754_ynl (int n, long double x) temp = s + c; break; } +/* With GCC 8 when compiling with -O the compiler + warns that the variable 'temp', may be used uninitialized. + The switch above should cover all possible values of n & 3 + so I belive it's false possitive. */ +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); b = invsqrtpi * temp / sqrtl (x); +DIAG_POP_NEEDS_COMMENT; } else {