+run_sbcl <<EOF
+ (load-shared-object (truename "$TEST_FILESTEM.addr.heap.so"))
+ (define-alien-type foo (struct foo (x int) (y int)))
+
+ (define-alien-variable a foo)
+ (define-alien-variable b (* foo))
+ (funcall (compile nil '(lambda () (setq b (addr a)))))
+ (assert (sb-sys:sap= (alien-sap a) (alien-sap (deref b))))
+ (exit :code $EXIT_LISP_WIN)
+EOF
+check_status_maybe_lose "ADDR of a heap-allocated object" $?
+
+run_sbcl <<EOF
+ (define-alien-type inner (struct inner (var (unsigned 32))))
+ (define-alien-type outer (struct outer (one inner) (two inner)))
+
+ (defvar *outer* (make-alien outer))
+ (defvar *inner* (make-alien inner))
+ (setf (slot *inner* 'var) 20)
+ (setf (slot *outer* 'one) *inner*)
+ (assert (= (slot (slot *outer* 'one) 'var) 20))
+ (setf (slot *inner* 'var) 40)
+ (setf (slot *outer* 'two) *inner*)
+ (assert (= (slot (slot *outer* 'two) 'var) 40))
+ (exit :code $EXIT_LISP_WIN)
+EOF
+check_status_maybe_lose "struct offsets" $?
+
+cat > $TEST_FILESTEM.alien.enum.lisp <<EOF
+(define-alien-type foo-flag
+ (enum foo-flag-
+ (:a 1)
+ (:b 2)))
+
+(define-alien-type bar
+ (struct bar
+ (foo-flag foo-flag)))
+
+(define-alien-type barp
+ (* bar))
+
+(defun foo (x)
+ (declare (type (alien barp) x))
+ x)
+
+(defun bar (x)
+ (declare (type (alien barp) x))
+ x)
+EOF
+expect_clean_compile $TEST_FILESTEM.alien.enum.lisp