Date: Wed, 4 May 2005 21:51:53 +0200 From: Marc Olzheim <marcolz@stack.nl> To: Daniel Eischen <deischen@freebsd.org> Cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread Message-ID: <20050504195153.GC76171@stack.nl> In-Reply-To: <Pine.GSO.4.43.0505041512050.498-100000@sea.ntplx.net> References: <20050504183132.GA76171@stack.nl> <Pine.GSO.4.43.0505041512050.498-100000@sea.ntplx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--zbGR4y+acU1DwHSi
Content-Type: multipart/mixed; boundary="TYecfFk8j8mZq+dy"
Content-Disposition: inline
--TYecfFk8j8mZq+dy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, May 04, 2005 at 03:15:06PM -0400, Daniel Eischen wrote:
> > It seems to me like something about the floorf() assembly might have
> > something to do with it.
>=20
> Yeah, I was just trying to narrow down the problem a bit more.
I've attached one that's built very tight around floorf().
Marc
--TYecfFk8j8mZq+dy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=Makefile
all: fpu6 fpu6th
fpu6th: fpu6.c
cc -O3 -Wall -W -Werror -Wno-unused -g -Wcast-qual -DWITH_THR -fstrict-aliasing -pthread fpu6.c -o fpu6th -lm
fpu6: fpu6.c
cc -O3 -Wall -W -Werror -Wno-unused -g -Wcast-qual -fstrict-aliasing fpu6.c -o fpu6 -lm
clean:
rm -f fpu6 fpu6th fpu6th.core core
--TYecfFk8j8mZq+dy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fpu6.c"
/* Blame it in Marc Olzheim (Zlo) */
#ifdef WITH_THR
#include <pthread.h>
#endif /* WITH_THR */
#include <err.h>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
void *
calc_thread(void *arg)
{
float f;
for (;;) {
f = floorf((float)1.0 / (float)((long)arg + 1L));
if (f > (float)1.0) /* Never true, but needed to use f. */
printf("\r%f", (double)f);
}
/* NOTREACHED */
return NULL;
}
int
main(int argc, char *argv[])
{
#ifdef WITH_THR
pthread_t thread;
if (pthread_create(&thread , NULL, calc_thread, (void *)1L))
err(1, "pthread_create()");
#else /* ! WITH_THR */
(void)calc_thread((void *)1L);
#endif /* ! WITH_THR */
for (;;)
sleep(60);
/* NOTREACHED */
return 0;
}
--TYecfFk8j8mZq+dy--
--zbGR4y+acU1DwHSi
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)
iD8DBQFCeSfZezjnobFOgrERAq6pAJwLIrgWFmhQJC+nBk+eGEpJNP1CzACguTUG
fFj9Zit2QQLReKSybmgQWTQ=
=vTI4
-----END PGP SIGNATURE-----
--zbGR4y+acU1DwHSi--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050504195153.GC76171>
