X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcallback.impure.lisp;h=bc1ebe4cdb4ec7a30f671f039dcbbb30c1ead669;hb=2fb5b174f6acb88a85c86aa4cd753ddefaccc987;hp=d2440b4e4675dbba2c5475031859be8bd2861c9e;hpb=b4a85c101536166d4b6521d3a28d5cef5937dc6b;p=sbcl.git diff --git a/tests/callback.impure.lisp b/tests/callback.impure.lisp index d2440b4..bc1ebe4 100644 --- a/tests/callback.impure.lisp +++ b/tests/callback.impure.lisp @@ -126,3 +126,25 @@ (assert (= 26 (alien-funcall foo))) +;;; callbacks with void return values + +(with-test (:name void-return) + (sb-alien::alien-lambda void () + (values))) + +;;; tests for a sign extension problem in callback argument handling on x86-64 + +(defvar *add-two-ints* (sb-alien::alien-callback (function int int int) #'+)) + +(with-test (:name :sign-extension) + (assert (= (alien-funcall *add-two-ints* #x-80000000 1) -2147483647))) + +;;; On x86 This'll signal a TYPE-ERROR "The value -2147483649 is not of type +;;; (SIGNED-BYTE 32)". On x86-64 it'll wrap around to 2147483647, probably +;;; due to the sign-extension done by the (INTEGER :NATURALIZE-GEN) +;;; alien-type-method. I believe the former behaviour is the one we want. +;;; -- JES, 2005-10-16 + +(with-test (:name :underflow-detection :fails-on :x86-64) + (assert (raises-error? (alien-funcall *add-two-ints* #x-80000000 -1)))) +