Subject: port-sparc64/20140: bug in lib/libc/arch/sparc64/gen/fabs.S
To: None <gnats-bugs@gnats.netbsd.org>
From: Lloyd Parkes <lloyd@must-have-coffee.gen.nz>
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
>Closed-Date:
>Last-Modified:
>Originator:     Lloyd Parkes
>Release:        NetBSD 1.6
>Organization:
Must Have Coffee
>Environment:
System: NetBSD archangel.must-have-coffee.gen.nz 1.6 NetBSD 1.6 (Archangel) #0: Fri Oct 18 21:12:41 NZDT 2002 lloyd@archangel.must-have-coffee.gen.nz:/usr/src/sys/arch/sparc64/compile/Archangel sparc64
Architecture: sparc64
Machine: sparc64
gcc (GCC) 3.2.1
>Description:

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.

>How-To-Repeat:

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.

>Fix:

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 @@
 
 
 ENTRY(fabs)
-	stx	%o0, [%sp + BIAS + 32]	! return value => %f0:f1
-	ldd	[%sp + BIAS + 32], %f0	! (via kernel %o0/%o1 slot)
 	retl
 	 fabss	%f0, %f0		! return absolute value

>Release-Note:
>Audit-Trail:
>Unformatted: