Floating point traps are triggered by alien code.

Bug #1519630 reported by ender
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

When making foreign function calls (with sb-alien or a wrapper such as cffi), sbcl will trap floating point errors that happen in the C code, and by default sbcl traps on errors that aren't typically on in c code (the default mode in C99 is to be in nonstop mode, ie no fp exceptions trigger a SIGFPE).

This means that foreign function calls need to be wrapped in sb-int:with-float-traps-masked or clear traps with sb-ing:set-floating-point-modes. Both of which are awkward and tricky to use portably.

SBCL should probably make foreign function calls with the floating point environment set to the default.

Revision history for this message
Gábor Melis (melisgl) wrote : Re: [Bug 1519630] [NEW] Floating point traps are triggered by alien code.

ender <email address hidden> writes:

> This means that foreign function calls need to be wrapped in sb-int
> :with-float-traps-masked or clear traps with sb-ing:set-floating-point-
> modes. Both of which are awkward and tricky to use portably.
>
> SBCL should probably make foreign function calls with the floating point
> environment set to the default.

+1 from user's point of view.

Revision history for this message
Vinced (vincezd) wrote :

It affects us on the IUP library: https://github.com/lispnik/iup/issues/30 We are forced to run our snippets with

```
#+sbcl
(sb-int:with-float-traps-masked
    (:divide-by-zero :invalid)
  (callback))
```

Revision history for this message
Michał "phoe" Herda (phoe-krk) wrote :

Also visible in cl-opengl - https://github.com/3b/cl-opengl/issues/98

Revision history for this message
Stas Boukarev (stassats) wrote :

What is visible in cl-opengl? That "SBCL should probably make foreign function calls with the floating point environment set to the default." will make everything slow?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.