Type-checking of alien structure slots
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Confirmed
|
Low
|
Unassigned |
Bug Description
tests/foreign.
it fails when SBCL is built without sb-eval.
The following is an extraction which triggers it:
(define-alien-type a (struct a (x (unsigned 32))))
(define-alien-type b (struct b (y a)))
(setf (slot (make-alien b) 'y) (make-alien a))
=>
#<SB-ALIEN-
is not of type (ALIEN (STRUCT A (X #)))
(a quick way to get it fail without recompiling with sb-eval disabled
is to remove (let ((*evaluator-mode* :interpret)) ...)
in sb-alien:
When B is defined as (define-alien-type b (struct b (y (* a)))),
everything works.
So, the questions are:
* Should it be defined as (* a)?
* If so, should it signal an error even when *evaluator-mode* is :interpret?
** I would think it should, because it doesn't even when it's clearly
a wrong type, e.g. (setf (slot (make-alien b) 'y) (make-alien int)) succeeds.
Marking as confirmed, but not commenting on what exactly should be done.
Alien pointer types are IIRC somewhat magical, but the details of how escape me -- and I'm not sure I ever figured out the "why".