From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57092 invoked by alias); 17 Dec 2018 21:32:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 57082 invoked by uid 89); 17 Dec 2018 21:32:29 -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-f46.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=76zCvjgHwT0K92QlTuRQW4yKLS7ONXgBnf+iw5Cyto4=; b=Iic0CxpDYNxgmwdhQrCc6xAU1otMiXhYzgtrNUQ2grgtpz9dThhECs7SjOwPqkkb9a JU1BM0/XMcfC9yJ/slpeqg0O4HYD4M9+Cvl7EV+Snl3VQIZw4CoXCyqq8daS1eiCNMxh nRWr04ETcZxtkkkZySRIjvcz0JkSrRoPdMkQ+YO8k9zoyCBgLc0cON3KNdv2en6OTmMp g4JhxIc4qA0eWjbcXQn0DDf+lGbAh2AoQacsqX4yQxEyclZrcHcnFG54a6t76YMqbk2/ jX5Fz0QHlgnyC44Xa8P0BVGIp2l70SgxUdoVORFmXZv76CdulP8Akw8fqkrZRgla7vRP OV+A== Return-Path: From: Martin Jansa To: libc-alpha@sourceware.org Cc: schwab@suse.de, joseph@codesourcery.com, Martin Jansa Subject: [PATCHv7] sysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ #19444] Date: Mon, 17 Dec 2018 21:36:00 -0000 Message-Id: <20181217213223.25527-1-Martin.Jansa@gmail.com> In-Reply-To: References: X-SW-Source: 2018-12/txt/msg00580.txt.bz2 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); ~~~~~~~~~~^~~~~~ ../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_jn': ../sysdeps/ieee754/dbl-64/e_jn.c:113:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] b = invsqrtpi * temp / sqrt (x); ~~~~~~~~~~^~~~~~ ../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_yn': ../sysdeps/ieee754/dbl-64/e_jn.c:320:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] b = invsqrtpi * temp / sqrt (x); ~~~~~~~~~~^~~~~~ Build tested with Yocto for ARM, AARCH64, X86, X86_64, PPC, MIPS, MIPS64 with -O, -O1, -Os. For soft-fp ARM it needs one more fix for -O1: https://sourceware.org/ml/libc-alpha/2018-09/msg00300.html For AARCH64 it needs one more fix in locale for -Os: https://sourceware.org/ml/libc-alpha/2018-09/msg00539.html [BZ #19444] * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise. Signed-off-by: Martin Jansa --- ChangeLog | 8 ++++++++ sysdeps/ieee754/dbl-64/e_jn.c | 2 ++ sysdeps/ieee754/ldbl-128/e_jnl.c | 4 ++++ sysdeps/ieee754/ldbl-128ibm/e_jnl.c | 4 ++++ sysdeps/ieee754/ldbl-96/e_jnl.c | 4 ++++ 5 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 99339f4605..2e12129846 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-12-17 Martin Jansa + + Partial fix for [BZ #19444] + * sysdeps/ieee754/dbl-96/e_jnl.c: Fix build with -O + * sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise. + * sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise. + * sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise. + 2018-12-17 Mao Han * sysdeps/unix/sysv/linux/Makefile: Add statx_cp.c. diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index aff06ead16..90a7e77270 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -109,6 +109,7 @@ __ieee754_jn (int n, double x) case 1: temp = -c + s; break; case 2: temp = -c - s; break; case 3: temp = c - s; break; + default: __builtin_unreachable (); } b = invsqrtpi * temp / sqrt (x); } @@ -316,6 +317,7 @@ __ieee754_yn (int n, double x) case 1: temp = -s - c; break; case 2: temp = -s + c; break; case 3: temp = s + c; break; + default: __builtin_unreachable (); } b = invsqrtpi * temp / sqrt (x); } diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c index 7610d18c67..3c90072a22 100644 --- a/sysdeps/ieee754/ldbl-128/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128/e_jnl.c @@ -150,6 +150,8 @@ __ieee754_jnl (int n, _Float128 x) case 3: temp = c - s; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } @@ -386,6 +388,8 @@ __ieee754_ynl (int n, _Float128 x) case 3: temp = s + c; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c index 50b4558e74..478824c8fa 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c @@ -150,6 +150,8 @@ __ieee754_jnl (int n, long double x) case 3: temp = c - s; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } @@ -386,6 +388,8 @@ __ieee754_ynl (int n, long double x) case 3: temp = s + c; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c index 855190841b..6c1c4b4653 100644 --- a/sysdeps/ieee754/ldbl-96/e_jnl.c +++ b/sysdeps/ieee754/ldbl-96/e_jnl.c @@ -143,6 +143,8 @@ __ieee754_jnl (int n, long double x) case 3: temp = c - s; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } @@ -372,6 +374,8 @@ __ieee754_ynl (int n, long double x) case 3: temp = s + c; break; + default: + __builtin_unreachable (); } b = invsqrtpi * temp / sqrtl (x); } -- 2.17.1