Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Libm core dump with SIGILL



> On Aug 21, 2015, at 8:35 AM, Greg Stark <stark%mit.edu@localhost> wrote:
> 
> While running the Postgres regression tests I found that the exp()
> function in libm gets a SIGILL with certain arguments.
> 
> simh$  gcc -Wall  exp.c -lm
> simh$ ./a.out
> [4]   Illegal instruction (core dumped) ./a.out
> 
> On a modern architecture with IEEE floats:
> 
> $ gcc -Wall  exp.c -lm
> $ ./a.out
> exp(88.0297) = 1.70141e+38
> 
> I know the VAX floating points are not exactly IEEE and they may not
> be able to represent this value but I would expect them to get a FPE
> or signal overflow in some other way, not get a SIGILL?

SIGILL is a compiler bug (if the implementation of exp() is in C) or a programmer error (if it's in assembler).

VAX float comes in 4 flavors: the original two, called "F" and "D" (32 and 64 bits) which were taken from the PDP-11 and predate IEEE -- and the newer two, called "G" and "H".  G is IEEE double precision (64 bits); H is 128 bit.  GCC can generate G-float code if you ask it but it looks like it does the older form by default.

F/D float have an 8 bit exponent, which makes the upper limit just about the value you expected (1.7e+38).  So it looks like you just barely hit a float overflow.  And for F/G, the result of overflow is an overflow trap -- an exception.

	pal



Home | Main Index | Thread Index | Old Index