git: 0c00dbfeb0c8 - main - msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 07 Aug 2024 09:56:18 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0c00dbfeb0c814c3a87a4d490db3692c1f9441e9

commit 0c00dbfeb0c814c3a87a4d490db3692c1f9441e9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-08-06 14:50:57 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-08-07 08:46:48 +0000

    msun/ld80/e_powl.c: make powl() thread-safe by making static variables thread-local
    
    Reported and tested by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
    Reviewed by:    imp
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D46237
---
 lib/msun/ld80/e_powl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/msun/ld80/e_powl.c b/lib/msun/ld80/e_powl.c
index 34978b964559..d04d77a5ee98 100644
--- a/lib/msun/ld80/e_powl.c
+++ b/lib/msun/ld80/e_powl.c
@@ -230,13 +230,13 @@ static const long double R[] = {
 static const long double MAXLOGL = 1.1356523406294143949492E4L;
 static const long double MINLOGL = -1.13994985314888605586758E4L;
 static const long double LOGE2L = 6.9314718055994530941723E-1L;
-static volatile long double z;
-static long double w, W, Wa, Wb, ya, yb, u;
+static _Thread_local volatile long double z;
+static _Thread_local long double w, W, Wa, Wb, ya, yb, u;
 static const long double huge = 0x1p10000L;
 #if 0 /* XXX Prevent gcc from erroneously constant folding this. */
 static const long double twom10000 = 0x1p-10000L;
 #else
-static volatile long double twom10000 = 0x1p-10000L;
+static _Thread_local volatile long double twom10000 = 0x1p-10000L;
 #endif
 
 static long double reducl( long double );