FLOATING-POINT-OVERFLOW triggered when calling Foreign Function in GLUT
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
# Bug Description
I ran the following code:
```lisp
(require :cffi)
(cffi:define-
(:darwin (:framework "GLUT")))
(cffi:load-
(cffi:defcfun ("glutCreateWindow" create-window) :int
(title :string))
(create-window "Test Window")
```
I expected the `create-window` function to return 1. If I use `ecl` to run the same code, it succeeds and returns 1. If I write an equivalent C code, it also returns 1.
```c
#include <stdio.h>
int glutCreateWindo
int main() {
int ret = glutCreateWindo
printf("%d", ret);
return 0;
}
```
Running `gcc -framework GULT test.c -o test && ./test` prints 1.
So, the problem isn't in the GLUT library. But somewhere in SBCL. Since GLUT is installed by default in MacOS the above example must be simple to replicate. It would have been better if I could reproduce the problem without GLUT or reduce the replication code but I couldn't narrow down what triggers this.
# sbcl --version
SBCL 2.4.3
# uname -a
Darwin bpanthi977-
# *features*
(:QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX :OS-UNIX
:NON-BASE-
:COMMON-LISP :DARWIN :IEEE-FLOATING-
:PACKAGE-
:SB-THREAD :SB-UNICODE :SBCL :UNIX)
You need sb-int: with-float- traps-masked