Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 1996 16:15:12 +1000 (EST)
From:      Douglas Thomas Crosher  <dtc@scrooge.ee.swin.oz.au>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1275: Sun libm i387 'exp' leaves two valid values on the FP stack.
Message-ID:  <199605290615.QAA11604@scrooge.ee.swin.oz.au>
Resent-Message-ID: <199605290620.XAA09649@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1275
>Category:       bin
>Synopsis:       Sun libm i387 'exp' leaves two valid values on the stack
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 28 23:20:01 PDT 1996
>Last-Modified:
>Originator:     Douglas Crosher
>Organization:
Swinburne University
>Release:        FreeBSD 2.2-CURRENT i386
>Environment:

	NA

>Description:

I've found what I think may be a bug with the 387 version of
'exp'. On return it leaves two valid values on the stack. I suspect
this does not conform to the C passing convention.

This may cause gcc some trouble if it tried to use all the FP regs as
it would receive a premature stack overflow.

Further, I'm trying to speed up C calls in CMUCL and have assumed that
C functions leave the FP stack empty unless a FP value is returned,
in which case it is on the ST and the rest the of regs are empty - the
behavior of exp, leaving two valid values on the stack, causes
trouble. 

>How-To-Repeat:

	Compile up the i387 version of the Sun libm. Then check the
return FP stack state for exp. Or look over the code and note that it
leaves two valid values on the stack.

>Fix:
	
*** e_exp.S.orig	Fri Aug 19 21:14:14 1994
--- e_exp.S	Tue May 28 23:30:45 1996
***************
*** 50,53 ****
--- 50,54 ----
  	fld1
  	faddp				/* 2^(fract(x * log2(e))) */
  	fscale				/* e^x */
+ 	fstpl	%st(1)
  	ret

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605290615.QAA11604>