Floating point traps are triggered by alien code.

Bug #1519630 reported by ender on 2015-11-25
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SBCL
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.

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.

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))
```

Michał "phoe" Herda (phoe-krk) wrote :

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

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  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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