Closed davidmullen closed 6 months ago
This one requires some more serious investigation to figure out how I messed up, in case it could affect more locations in the rest of the code. Would you have a small piece of code that triggers the bug? I would find that useful here. Thanks.
The trigger is a structure with at least 63 slots:
(eval `(defstruct test-struct
,@(loop for i from 0 to 70
collect `(,(make-symbol (format nil "SLOT-~D" i))
,(format nil "~R" i)))))
Then (make-test-struct)
should give:
#S(TEST-STRUCT :SLOT-0 "zero" :SLOT-1 "one" ...)
But instead, it ends up with wrong values in the slots:
#S(TEST-STRUCT :SLOT-0 #<The STRUCTURE-CLASS TEST-STRUCT 140243168666272> :SLOT-1 "zero" ...)
When I saw that a
defstruct
with 63 or more slots wasn't processed correctly, I suspected that it was hitting a stack limit, namelysi:c-arguments-limit
. Adjusting themin_arg
argument tomkcl_setup_for_rest
solves the problem, as it callsmkcl_va_start
to set the stack pointer. A similar fix is forsi:put-properties
.