Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jan 2004 13:56:32 -0800
From:      David Schultz <das@FreeBSD.ORG>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/gdtoa Makefile.inc _hdtoa.c src/lib/libc/stdio vfprintf.c
Message-ID:  <20040118215632.GA56462@VARK.homeunix.com>
In-Reply-To: <20040118210356.GA82925@dhcp01.pn.xcllnt.net>
References:  <200401181032.i0IAWoMh012953@repoman.freebsd.org> <20040118103340.GA44149@VARK.homeunix.com> <20040118210356.GA82925@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 18, 2004, Marcel Moolenaar wrote:
> Currently stdtod() is causing a SIGFPE on ia64 for a kernel build.
> This started when obrien@ added the following code to kern.post.mk:
> 
> +emu10k1-alsa%diked.h: $S/gnu/dev/sound/pci/emu10k1-alsa.h
> +       grep -v '#include' ${.OODATE} | ${CC} -E -D__KERNEL__ -dM - \
> +           | awk -F"[  (]" '/define/ \
> +           { print "#ifndef " $$2 ; print ; print "#endif" }' \
> +           >${.TARGET}
> +.if !exists(${.OBJDIR}/.depend)
> +_kernel-depend: emu10k1-alsa%diked.h
> +.endif
>                                                                                 
> The problem is that awk(1) gets a SIGFPE unconditionally. I haven't
> spent too much time on it yet, but I get the following in the gdb(1):
>  
> Program received signal SIGFPE, Arithmetic exception.
> 0x40000000000553d2 in strtod (s00=0x600000000001c02d "e-324",
>     se=0x9fffffffffffe6f0) at gdtoa_strtod.c:938
> 938                     dval(rv) *= dval(rv0);

I don't think this is strtod's fault.  awk crashes for the same
reason the following program gets a SIGFPE:

	das@pluto1:~> cat bar.c
	int main() {
		double d = 4.0083367200179456e-292;
		d *= 0x1.0p-106;
	}
	
	das@pluto1:~> gcc bar.c
	das@pluto1:~> ./a.out
	Floating exception (core dumped)

The correct result is 4.940656e-324, which is denormalized.  Some
architectures generate a trap for denormals and expect them to be
handled in software, but I didn't think that IA64 was one of them.
I'm looking over the IA64 architecture manual now to see if I can
figure out what's going on...



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