Opened 14 years ago
Closed 14 years ago
#107 closed defect (fixed)
(setf (values (struct-slot struct)) (values 42)) fails
Reported by: | Mahmud Mohamed | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | compiler | Version: | |
Keywords: | SETF VALUES STRUCT-SLOT | Cc: | |
Parent Tickets: |
Description
;;; reported by Zach Beane
;;; http://common-lisp.net/pipermail/armedbear-devel/2010-October/001521.html
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.
Change History (3)
comment:1 Changed 14 years ago by
Component: | CLOS → other |
---|---|
Priority: | major → minor |
Resolution: | → worksforme |
Status: | new → closed |
comment:2 Changed 14 years ago by
Component: | other → compiler |
---|---|
Priority: | minor → major |
Resolution: | worksforme |
Status: | closed → reopened |
Sorry folks; the interpreter is fine but the code is broken when compiled and loaded.
Problem remains.
comment:3 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I am unable to confirm this. FWIW, I am running trunk ABCL with the patch for the long form of define-method-combination (#66)
CL-USER> (in-package #:abcl-bug)
#<PACKAGE "ABCL-BUG">
ABCL-BUG> (trigger)
#S(MYSTRUCT :SLOT 42)
ABCL-BUG> (lisp-implementation-type)
"Armed Bear Common Lisp"
ABCL-BUG> (lisp-implementation-version)
"0.22.0-dev"
ABCL-BUG>