This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the EGCS project.
Re: PATCH for loop.c, SIGFPE with bad integer operands on host (linux-)ix86
- To: law@cygnus.com
- Subject: Re: PATCH for loop.c, SIGFPE with bad integer operands on host (linux-)ix86
- From: Andi Kleen <ak-uu@muc.de>
- Date: 04 Aug 1999 09:22:54 +0200
- cc: egcs@egcs.cygnus.com
- References: <Pine.BSF.4.10.9908031834570.14732-100000@dair.pair.com> <7368.933725371@upchuck.cygnus.com>
law@cygnus.com (Jeffrey A Law) writes:
> In message <Pine.BSF.4.10.9908031834570.14732-100000@dair.pair.com>you write:
> > There's a (well-known?) problem with integer arithmetic on
> > (linux-)ix86 platforms: Doing signed integer modulus or
> > division on (0x80000000 / -1) or (0x80000000 % -1) gives a
> > SIGFPE. This is ix86-specific, and maybe possible to work
> > around in the right interrupt handler in the kernel for
> > those who know that stuff. This happens on linux 2.0.30
> > with a PPro as well as on linux 2.2.1 with a PII, and
> > probably on non-linux systems as well; I believe cygwin b20.1
> > has the same problem.
> The kernel trap handlers need to be fixed.
>
> It's a common problem, in fact, I had to fix PA kernels in a similar manner
> a couple times over the years.
x86 has no magic traphandlers for math in kernel, it is all done in
microcode. The kernel just hands on the exception as SIGFPE without
even looking at it. Adding disassembly hacks to the kernel is probably
not worth it (if you seriously want you can add it in user space, but
it is probably better to fix the code), also the x86 behaviour is
allowed by the C standard. Unfortunately the CPU has no easy way to mask it.
-Andi
--
This is like TV. I don't like TV.