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 10:01 AM, Anders Magnusson <ragge%ludd.ltu.se@localhost> wrote:
> Greg Stark skrev den 2015-08-21 14:35:
>> 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?
> Well, not in VAX FP.  From the man page for exp:
>     These functions will return the appropriate computation unless an error
>     occurs or an argument is out of range.  The functions exp() and expm1()
>     detect if the computed value will overflow, set the global variable errno
>     to ERANGE and cause a reserved operand fault on a VAX.
> So, it is following the specs... :-)

But SIGILL means illegal instruction, not reserved operand.  Isn't EMODD an optional instruction?  I wonder if the issue is that it's not recognized on Greg's platform so he ends up with the wrong exception.

Wouldn't it be cleaner for the code to call signal() rather than attempt to force a particular signal by using a weird instruction?


Home | Main Index | Thread Index | Old Index