possible abcl bug: incorrectly deletes "unused" local function

Vibhu Mohindra vibhu.mohindra at gmail.com
Sun Apr 5 18:51:45 UTC 2015


Awesome. Confirmed, fixed.

Sorry about the incomplete bug report, Mark. But you figured out the problem and diagnosed it anyway.

What I missed was submitting the driver function, sample2:

(defun sample2 (n)
  (do ((x (=sample2 n) (funcall (cadr x))))
      ((not (and (consp x) (eq (car x) 'more))) x)))

----
Here is a transcript showing the bug manifesting in 1.3.1 but fixed in the SVN snapshot now. (1 is the correct expected return value of calling (sample2 1)).

VibhuMondrasMBP:t vibhu$ cat abcl-bug.lisp 
(defun =sample2 (n)
  (macrolet ((f (result x)
                `(list 'more (lambda () (=f ,result ,x))))
             (g (result x)
                `(list 'more (lambda () (=g ,result ,x)))))
    (labels ((=f (result x)
               (if (zerop x)
                 result
                 (g (1+ result) (1- x))))
             (=g (result x)
               (f result x)))
      (f 0 n))))
(defun sample2 (n)
  (do ((x (=sample2 n) (funcall (cadr x))))
      ((not (and (consp x) (eq (car x) 'more))) x)))

VibhuMondrasMBP:t vibhu$ abcl.sh
Armed Bear Common Lisp 1.3.1
Java 1.8.0_11 Oracle Corporation
Java HotSpot(TM) 64-Bit Server VM
Low-level initialization completed in 0.471 seconds.
Startup completed in 2.397 seconds.
Loading /Users/vibhu/.abclrc completed in 14.64 seconds.
Type ":help" for a list of available commands.
CL-USER(1): (load "abcl-bug")
; Note: deleting unused local function LABELS =G
T
CL-USER(2): (sample2 1)
#<THREAD "interpreter" {5EBBB15C}>: Debugger invoked on condition of type UNDEFINED-FUNCTION
  The function =G is undefined.
Restarts:
  0: CONTINUE     Try again.
  1: USE-VALUE    Specify a function to call instead.
  2: RETURN-VALUE Return one or more values from the call to =G.
  3: TOP-LEVEL    Return to top level.
[1] CL-USER(3): 

vibhu:~/abcl$ java -jar dist/abcl2.jar
Armed Bear Common Lisp 1.4.0-dev-svn-svn- The path '.' appears to be part of a Subversion 1.7 or greater
Java 1.6.0_07 Sun Microsystems Inc.
Java HotSpot(TM) Client VM
Low-level initialization completed in 0.558 seconds.
Startup completed in 3.288 seconds.
Type ":help" for a list of available commands.
CL-USER(1): (load "abcl-bug")
T
CL-USER(2): (sample2 1)
1
CL-USER(3): 





More information about the armedbear-devel mailing list