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: 976571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96158-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ctrpbWb6"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gpdvllAR"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Mlb20v6Jz9s1x for ; Sat, 29 Sep 2018 20:46:20 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=c6a8ZHxAab8W8+pgRtbGB4QEPjCapa/ mJYx4lPRCFEMYn89g8y76n9DqJukpdvu+TQZeifAluiSbSZ65UTi7Sfy9m4+JMlG G/kbQSyS3RTr5f8iFgpbFTsjyno6yiPG3sVu1kOtm+2wLLgL0HDbF3qYluqXunO0 r4DCrmblhIXo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=mbqAqxi4nvjVEEJvLiqwYWJb/dI=; b=ctrpb Wb6VqAb4d121WK+SmmfME4wwod9uVC555eLZ6gRQ448cpn+Nfdu72sGyCZLANC3z BFiPaKrcl+N7rkfzw90Wk//yQHxUR0e/fq71Qai4TX0NmKhK4cjYJlYWi9/fu+D5 OeSQD+7xccqr6gCZeENBjTquU2iirsS5QqAzus= 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== 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 {