close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Opened 12 years ago

Closed 12 years ago

#72 closed defect (fixed)

SIGFPE with no exceptions currently enabled?

Reported by: Raymond Toy Owned by: somebody
Priority: major Milestone:
Component: Core Version: 2013-01
Keywords: Cc:

Description

While I've seen this SIGFPE issue before, I never tracked it down. Here is a repeatable case (from Carl):

    (defun test (x y)
      (declare (optimize (speed 3) (safety 0))
               (type (signed-byte 32) x y))
      (the (signed-byte 32) (truncate x y)))

Although the code lies to the compiler (the asserted return type of truncate is incorrect), the point is that (test #x-80000000 -1) causes the SIGFPE exception.

I believe sigfpe-handler was only expecting to handle FP exceptions. In this example, the division causes an overflow which generates the SIGFPE.

Change History (1)

comment:1 Changed 12 years ago by toy.raymond@…

Resolution: fixed
Status: newclosed

commit 0174bfebdb2ed8edbdf5b3dade4fd64965d4a9f4 Author: Raymond Toy <toy.raymond@…> Date: Thu Jan 31 21:27:36 2013 -0800

Fix ticket:72 : SIGFPE with no exceptions enabled

code/float-trap.lisp
  • In the default case, check FOP to see if it's defined. This means it's a divide exception.
code/x86-vm.lisp
  • Also check to see if the offending instruction is a DIV or IDIV, which means we got an integer overflow. Return the appropriate values in this case.
Note: See TracTickets for help on using tickets.