www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000080

When Created: 05/03/1996 07:34:37
Against DJGPP version: 2.00
By whom: demmer@lstm.ruhr-uni-bochum.de
Abstract: Coprocessor stack overflow with libm
ldexp() has a bug which cases the numeric coprocessor stack
to overflow if called several times. 
The bug can be traced down to src/libm/src/s_scalb.s:
It loads two operands, but leaves one of them on the stack:
  fild [esp+12]
  fldq [esp+4]
  fscale
  ret

Some other math functions use this routine and can crash under
quite rare circumstances.

Solution added: 05/06/1996 06:42:34
By whom: demmer@lstm.ruhr-uni-bochum.de
Change djgpp/src/libm/src/s_scalbn.S to:

ENTRY(scalbn)
	fidl 12(%esp)
	fldl  4(%esp)
	fscale
	fxch  %st(1)
	fincstp
	ret


and rebuild libm.a

Fixed in version 2.01 on 06/13/1996 00:47:46
By whom: dj@delorie.com



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010