[armedbear-devel] Bug: (setf (values (struct-slot struct)) (values 42)) fails

Zach Beane xach at xach.com
Fri Oct 1 14:18:29 UTC 2010

(The "Reporting bugs" link on the abcl site doesn't actually link
anywhere, so I'm mailing the list.)

Here's a file that triggers an ABCL bug:

    ;;;; abcl-bug.lisp

    (defpackage #:abcl-bug
      (:use #:cl)
      (:export #:trigger))

    (in-package #:abcl-bug)

    (defstruct mystruct

    (defun trigger ()
      (let ((struct (make-mystruct)))
        (setf (values (mystruct-slot struct))
              (values 42))

Here's what happens when I run it:

    Armed Bear Common Lisp 0.22.0
    Java 1.6.0_18 Sun Microsystems Inc.
    OpenJDK 64-Bit Server VM
    Low-level initialization completed in 0.445 seconds.
    Startup completed in 1.688 seconds.
    Type ":help" for a list of available commands.
    CL-USER(1): (load (compile-file "abcl-bug"))
    ; Compiling /tmp/abcl-bug.lisp ...
    ; (DEFUN TRIGGER ...)
    ; Wrote /tmp/abcl-bug.abcl (0.447 seconds)
    CL-USER(2): (abcl-bug:trigger)
    #<THREAD "interpreter" {1653033E}>: Debugger invoked on condition of type UNDEFINED-FUNCTION
      The function (SETF SYSTEM:STRUCTURE-REF) is undefined.
      0: TOP-LEVEL Return to top level.
    [1] CL-USER(3): :bt
      2: org.armedbear.lisp.Lisp.error(Lisp.java:353)
      3: org.armedbear.lisp.Symbol.getSymbolSetfFunctionOrDie(Symbol.java:399)
      4: org.armedbear.lisp.abcl_bug_9.execute(abcl-bug.lisp:11)
      5: org.armedbear.lisp.LispThread.execute(LispThread.java:552)
      6: org.armedbear.lisp.Lisp.evalCall(Lisp.java:514)
      7: org.armedbear.lisp.Lisp.eval(Lisp.java:485)
    [1] CL-USER(4): 

I would expect to get a structure back with SLOT set to 42, instead of
this error.

This is a strange case (you normally wouldn't use VALUES there) but it
comes from some larger real code that sets multiple struct slots from a
multiple-value-returning function.


More information about the armedbear-devel mailing list