From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 53FEB22B27 for ; Mon, 29 Jan 2024 15:05:08 +0100 (CET) Received: (qmail 7564 invoked by uid 550); 29 Jan 2024 14:02:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7529 invoked from network); 29 Jan 2024 14:02:45 -0000 Date: Mon, 29 Jan 2024 15:04:55 +0100 From: Szabolcs Nagy To: musl@lists.openwall.com Message-ID: <20240129140455.GC1254592@port70.net> Mail-Followup-To: musl@lists.openwall.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [musl] [PATCH] math: fix static const initializer in sqrtl A static const value cannot be used in a static const initializer, simply use const instead. This seems to matter for gcc-7 and older with -O0 and for gcc-4.4 and older with optimization. verified that with gcc-12 on aarch64 the generated code is unchanged. --- src/math/sqrtl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math/sqrtl.c b/src/math/sqrtl.c index 1b9f19c7..a231b3f2 100644 --- a/src/math/sqrtl.c +++ b/src/math/sqrtl.c @@ -205,7 +205,7 @@ long double sqrtl(long double x) top = (top + 0x3fff) >> 1; /* r ~ 1/sqrt(m) */ - static const uint64_t three = 0xc0000000; + const uint64_t three = 0xc0000000; uint64_t r, s, d, u, i; i = (ix.hi >> 42) % 128; r = (uint32_t)__rsqrt_tab[i] << 16; @@ -227,7 +227,7 @@ long double sqrtl(long double x) r = mul64(u, r) << 1; /* |r sqrt(m) - 1| < 0x1.c001p-59, switch to 128bit */ - static const u128 threel = {.hi=three<<32, .lo=0}; + const u128 threel = {.hi=three<<32, .lo=0}; u128 rl, sl, dl, ul; rl.hi = r; rl.lo = 0; -- 2.43.0