This is the mail archive of the gcc@gcc.gnu.org mailing list for the EGCS project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH for loop.c, SIGFPE with bad integer operands on host (linux-)ix86


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]