Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Oct 1995 01:03:39 +0100
From:      peter@citylink.dinoex.sub.org (Peter Much)
To:        freebsd-hackers@freebsd.org
Subject:   modf.S (in libc.a): stack access fault
Message-ID:  <199510200003.BAA14324@citylink.dinoex.sub.org>

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

The funktion modf() (in libc.a, from lib/libc/i386/gen/modf.S) seems to
dismangle the program stack. This is the reason why ingres cannot handle
float values with FreeBSD (and other OS's - i reported that here, somewhen
about May). If linked with lib/msun/src/s_modf.c instead, it does work.

A friend of mine had already reported this bug to Borland/Heimsoeth years
ago - so it was obviously not the latest version of the Borland compiler
library that made it into FreeBSD.:-((

To reproduce the error, try the following code:
----------------------------------------------------------------------
#include <stdio.h>

main()
{
	double arg = 0.0, fj;
	int i;
	char *p, buf[21];

	p = buf;
	for(i=0; i < 20; i++) {
		arg *= 10;
		(void)modf(arg, &fj);
		arg -= fj;
		*p++ = (int)fj + '0';
	}
	*p = '\0';
	printf("%s\n", buf);
}
----------------------------------------------------------------------
It crashes with i=7. I don't know math-copro-assembler, so i cannot
debug this.

Peter

P.S: Anybody wanting the ingres patches to build a port? 
-- 
  Write to:  Peter Much * Koelnische Str. 22 * D-34117 Kassel * +49-561-774961
            peter@citylink.dinoex.sub.org  *  much@hrz.uni-kassel.de



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