regression in alien compilation since 1.0.12 (?)

Bug #316075 reported by Nikodemus Siivola
2
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Nikodemus Siivola

Bug Description

Reported by Ken Olum to sbcl-devel on Jan 5 2009:

I get the error "The value NIL is not of type SB-KERNEL:CTYPE" when
trying to compile a function that uses the values returned from an
inline function defined by DEFINE-ALIEN-ROUTINE that has a return type
of "void" and an argument of type :OUT. For example compiling this file,

----------------------------------------------------------------------

(declaim (inline store))

(sb-alien:define-alien-routine "store" void
 (result char :out))

(defun do-store ()
 (multiple-value-list (store)))

----------------------------------------------------------------------

will generate the above error.

I am using X86-64. This happens in SBCL 1.0.23 and in 1.0.20, but not
in 1.0.12. It doesn't happen without the INLINE declaration. It
doesn't happen if I change void to int. If I macroexpand the
DEFINE-ALIEN-ROUTINE form, I get this:

(PROGN
 (DECLAIM (FTYPE (FUNCTION NIL (VALUES NULL (ALIEN CHAR) &OPTIONAL)) STORE))
 (DEFUN STORE ()
  (WITH-ALIEN ((STORE (FUNCTION VOID (* CHAR)) :EXTERN "store") (RESULT CHAR))
              (VALUES (ALIEN-FUNCALL STORE (ADDR RESULT)) RESULT))))

If I evaluate only the defun, I don't get the problem. If I evaluate
the DECLAIM as well, then I do, even though the function does in fact
appear to have the given type.

Apart from whenever is causing the compiler problem, I think it would
be better if when the return type is "void" DEFINE-ALIEN-ROUTINE
did not return the extra NIL.

Tags: alien compiler
Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Changed in sbcl:
assignee: nobody → nikodemus
Changed in sbcl:
status: Confirmed → Fix Committed
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

In 1.0.24.33 / 1.0.25.

Changed in sbcl:
status: Fix Committed → Fix Released
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.