NetBSD Problem Report #58337

From www@netbsd.org  Tue Jun 11 21:46:12 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4CCD01A9238
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 Jun 2024 21:46:12 +0000 (UTC)
Message-Id: <20240611214611.3BF0C1A923A@mollari.NetBSD.org>
Date: Tue, 11 Jun 2024 21:46:11 +0000 (UTC)
From: mrg@eterna23.net
Reply-To: mrg@eterna23.net
To: gnats-bugs@NetBSD.org
Subject: logl() crashes on arm64
X-Send-Pr-Version: www-1.0

>Number:         58337
>Category:       lib
>Synopsis:       logl() crashes on arm64
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    riastradh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 11 21:50:00 +0000 2024
>Closed-Date:    Tue Jul 23 20:44:45 +0000 2024
>Last-Modified:  Tue Jul 23 20:44:45 +0000 2024
>Originator:     matthew green
>Release:        -current
>Organization:
bozotic softwar foundation
>Environment:
arm64, cortex a-72
>Description:
pkgsrc/audio/fluidsynth build crashes in logl().  Taylor tracked it down
to the EXTRACT_LDBL128_WORDS() macro switching the high/low portions.
swapping the extu_fracl/extu_frach parts makes it work again.
>How-To-Repeat:
build pkgsrc/audio/fluidsynth on arm64.
>Fix:
Index: src/math_private.h
===================================================================
RCS file: /cvsroot/src/lib/libm/src/math_private.h,v
retrieving revision 1.32
diff -p -u -r1.32 math_private.h
--- src/math_private.h  3 Apr 2024 04:40:23 -0000       1.32
+++ src/math_private.h  11 Jun 2024 21:45:39 -0000
@@ -264,8 +264,8 @@ do {                                                                \
   union ieee_ext_u ew_u;                                       \
   ew_u.extu_ld = (d);                                          \
   (ix0) = GET_EXPSIGN(&ew_u);                                  \
-  (ix1) = ew_u.extu_fracl;                                     \
-  (ix2) = ew_u.extu_frach;                                     \
+  (ix1) = ew_u.extu_frach;                                     \
+  (ix2) = ew_u.extu_fracl;                                     \
 } while (0)

 /* Get expsign as a 16 bit int from a long double.  */

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: lib-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Tue, 11 Jun 2024 21:51:10 +0000
Responsible-Changed-Why:
om nom nom math PRs


State-Changed-From-To: open->analyzed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 11 Jun 2024 21:51:10 +0000
State-Changed-Why:
problem analyzed, needs automatic test


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58337 CVS commit: src/tests/lib/libm
Date: Mon, 15 Jul 2024 06:19:17 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Jul 15 06:19:17 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_log.c

 Log Message:
 tests/lib/libm/t_log.c: Expand to handle many more cases.

 Also make this much more concise.

 Prompted by PR lib/58337: logl() crashes on arm64


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libm/t_log.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58337 CVS commit: src/tests/lib/libm
Date: Tue, 16 Jul 2024 03:14:16 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Jul 16 03:14:16 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_log.c

 Log Message:
 tests/lib/libm/t_log: Expand some more.

 - Test nontrivial bit patterns for log, log2, log10, log1p.
 - Print long double with %.34g, not %.17g.
 - Sprinkle xfail for the ld128 code.

 PR lib/58337: logl() crashes on arm64


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libm/t_log.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58337 CVS commit: src
Date: Wed, 17 Jul 2024 11:59:58 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Jul 17 11:59:58 UTC 2024

 Modified Files:
 	src/lib/libm/src: math_private.h
 	src/tests/lib/libm: t_log.c

 Log Message:
 libm: Fix order of significand words in EXTRACT_LDBL128_WORDS.

 PR lib/58337


 To generate a diff of this commit:
 cvs rdiff -u -r1.32 -r1.33 src/lib/libm/src/math_private.h
 cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libm/t_log.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 23 Jul 2024 20:44:45 +0000
State-Changed-Why:
Unless we're going to pull up all the long double stuff to 10, I don't
think this needs pullups.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.