[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
      slot)

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

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 ...
    ; (DEFPACKAGE #:ABCL-BUG ...)
    ; (IN-PACKAGE #:ABCL-BUG)
    ; (DEFSTRUCT MYSTRUCT ...)
    ; (DEFUN TRIGGER ...)
    ; Wrote /tmp/abcl-bug.abcl (0.447 seconds)
    T
    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.
    Restarts:
      0: TOP-LEVEL Return to top level.
    [1] CL-USER(3): :bt
      0: (SYSTEM:BACKTRACE)
      1: (INVOKE-DEBUGGER #<UNDEFINED-FUNCTION {8FE2509}>)
      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.

Zach




More information about the armedbear-devel mailing list