Re: have a look at this proggie, please.

Steven Roberts (strobert@ata-sd.com)
Thu, 19 Nov 1998 17:10:04 -0800


David Weinehall wrote:
> That's NOT an divide by zero...
>
> Output:
>
> -2147483648 * -1 = -2147483648
> Floating exception
> ^^^^^^^^^^^^^^^^^^
>
> Quite obviously, -MAXINT-1 * -1 is too large for an integer to hold (by
> one), but it should *NOT* report a floating exception... Right?!

Not sure if this is Intelish behavior or POSIX, but divide by zero and
overflow are treated as SIGFPE's (FPE_INTOVFLOW and FPE_INTDIV0)

I just looked at this a bit back under borland (I do a lot of my work
with Borland still -- still working on convincing management to at least
try out linux). It looked like though it was the way the processor
reports them (from my 386/486 processor book -- can't check right now,
book got borrowed). (I had to patch Borland's RTL to allow me to step
over the offending instruction so I could ignore the behavior -- kind of
fun manually decoding DIV and IDIV in C code :)

So assuming that they are looped under FPE, then the behavior is
correct. the main signal is the SIGFPE, the sub action is FPE_INTOVLOW.

Regards,
Steven Roberts

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/