Subject: port-sparc64/20140: bug in lib/libc/arch/sparc64/gen/fabs.S
To: None <>
From: Lloyd Parkes <>
List: netbsd-bugs
Date: 02/01/2003 14:29:27
>Number:         20140
>Category:       port-sparc64
>Synopsis:       fabs.S is not so FAB
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 31 17:30:01 PST 2003
>Originator:     Lloyd Parkes
>Release:        NetBSD 1.6
Must Have Coffee
System: NetBSD 1.6 NetBSD 1.6 (Archangel) #0: Fri Oct 18 21:12:41 NZDT 2002 sparc64
Architecture: sparc64
Machine: sparc64
gcc (GCC) 3.2.1

The fabs library function contains bogus code. It probably hasn't been
updated to match the sparc64 floating point fixes that went in a while
back. This problem is difficult to find because gcc normally emits
inline assembler instead of calling the library function. 

As to why gcc is not generating the assembler instruction, I don't
have an answer. This will be passed on to the NetBSD and GNU
maintainers of GCC when I manage to nail down a test case.


Install gcc 3.2.1 from GNU (not from pkgsrc).

Download GMT 4.0 beta from private CVS and start playing.

Notice that grdimage generates bogus postscript and spend several days
tracking it down.


Apply this patch to lib/libc/arch/sparc64/gen/fabs.S version 1.2.

Index: fabs.S
RCS file: /vol/NetBSD/cvs-src/src/lib/libc/arch/sparc64/gen/fabs.S,v
retrieving revision 1.2
diff -u -r1.2 fabs.S
--- fabs.S	2000/07/23 07:12:22	1.2
+++ fabs.S	2003/02/01 01:28:07
@@ -52,7 +52,5 @@
-	stx	%o0, [%sp + BIAS + 32]	! return value => %f0:f1
-	ldd	[%sp + BIAS + 32], %f0	! (via kernel %o0/%o1 slot)
 	 fabss	%f0, %f0		! return absolute value