[cmucl-help] bugs in C::SOURCE-LOCATION and string reversal

Matt Kaufmann kaufmann at cs.utexas.edu
Mon May 13 14:07:16 UTC 2013


Hi --

I downloaded the 2013-05 snapshot from
http://trac.common-lisp.net/cmucl
(http://common-lisp.net/project/cmucl/downloads/snapshots/2013/05/cmucl-2013-05-x86-linux.tar.bz2),
and I am running into two bugs, discussed below.  The first is kind of
a show-stopper.  It's hit me before using CMUCL 19e (so I guess it's
been around awhile), but at that time I was able to avoid it simply by
not running my application in a particular "mode".  I'd appreciate any
suggestions for easily working around that first bug.  I've worked
around the second bug, but I thought I should report it, and I do so
at the end, below.

The first bug pertains to C::SOURCE-LOCATION.  Below is part of the
log, showing three errors during compilation followed by a break
during load of the resulting compiled file.

; 
; 
; File: /v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl at expansion.lsp

; In: DEFMACRO GL-BDD-MODE => DEFATTACH GL::BFR-MODE

;   (DEFATTACH GL::BFR-MODE GL::BFR-BDD)
; --> DEFPARAMETER PROGN LISP::SET-DEFVAR-SOURCE-LOCATION 
; --> LISP::SET-DEFVAR-SOURCE-LOCATION 
; ==>
;   (C::SOURCE-LOCATION)
; Error: (during macroexpansion)
; Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
;    27574 is not of type (UNSIGNED-BYTE 14)
; 

; In: DEFMACRO GL-BDD-MODE => DEFATTACH GL::BFR-COUNTEREX-MODE

;   (DEFATTACH GL::BFR-COUNTEREX-MODE GL::BFR-COUNTEREX-BDD)
; --> DEFPARAMETER PROGN LISP::SET-DEFVAR-SOURCE-LOCATION 
; --> LISP::SET-DEFVAR-SOURCE-LOCATION 
; ==>
;   (C::SOURCE-LOCATION)
; Error: (during macroexpansion)
; Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
;    27575 is not of type (UNSIGNED-BYTE 14)
; 

; In: DEFMACRO GL-BDD-MODE => DEFATTACH (GL::BFR-SAT GL::BFR-SAT-BDD)

;   (DEFATTACH (GL::BFR-SAT GL::BFR-SAT-BDD) :HINTS (# #))
; --> PROGN DEFPARAMETER PROGN LISP::SET-DEFVAR-SOURCE-LOCATION 
; --> LISP::SET-DEFVAR-SOURCE-LOCATION 
; ==>
;   (C::SOURCE-LOCATION)
; Error: (during macroexpansion)
; Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
;    27576 is not of type (UNSIGNED-BYTE 14)
; 

; Compilation unit finished.
;   3 errors

; Loading #P"/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f".

Execution of a form compiled with errors:
 (C::SOURCE-LOCATION)
   [Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]

Restarts:
  0: [CONTINUE] Return NIL from load of "/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f".
  1: [ABORT   ] Skip remaining initializations.

Debug  (type H for help)

("Top-Level Form")[:TOP-LEVEL]
Source: 
0] backtrace

0: ("Top-Level Form")[:TOP-LEVEL]
1: (LISP::FOP-FUNCALL-FOR-EFFECT)
2: (LISP::LOAD-GROUP
    #<Stream for file "/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f">)
3: (LISP::FASLOAD
    #<Stream for file "/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f">)
4: (LISP::INTERNAL-LOAD
    #P"/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f"
    #P"/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f"
    :ERROR :BINARY
    ...)
5: (LISP::INTERNAL-LOAD
    #P"/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f"
    #P"/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f"
    :ERROR NIL
    ...)
6: (LOAD "/v/filer4b/v11q002/acl2space/acl2/devel/books/centaur/gl/gl.sse2f"
         :VERBOSE NIL
         :PRINT ...)
.....

I tried a workaround or two with the sort of approach I used below for
the second error; but that didn't help.  Also, I don't care about
source location information, but I didn't see a way simply to turn it
off (as I do when compiling with CCL).

The second bug is in computing (reverse ""), as shown below.

------------------------------

charity:~> uname -a
Linux charity 2.6.32-46-generic-pae #108-Ubuntu SMP Thu Apr 11 16:11:56 UTC 2013 i686 GNU/Linux
charity:~> /projects/acl2/lisps/cmucl-snapshot-2013-05-20D-Unicode/bin/lisp
CMU Common Lisp snapshot-2013-05 (20D Unicode), running on charity
With core: /v/filer4b/v11q001/acl2/lisps/cmucl-snapshot-2013-05-20D-Unicode/lib/cmucl/lib/lisp-sse2.core
Dumped on: Sat, 2013-05-11 11:18:42-05:00 on lorien2
See <http://www.cmucl.org/> for support information.
Loaded subsystems:
    Unicode 1.29 with Unicode version 6.2.0
    Python 1.1, target Intel x86/sse2
    CLOS based on Gerd's PCL 2010/03/19 15:19:03
* (reverse "")


Error in function LISP::ASSERT-ERROR:
   The assertion (<= (OR C::END2 (LENGTH C::STRING2))
                     (LENGTH C::STRING2)) failed.
   [Condition of type SIMPLE-ERROR]

Restarts:
  0: [CONTINUE] Retry assertion.
  1: [ABORT   ] Return to Top-Level.

Debug  (type H for help)

(LISP::ASSERT-ERROR (<= (OR C::END2 #) (LENGTH C::STRING2)) NIL NIL)
Source: Error finding source: 
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
  target:code/macros.lisp.
0] 

------------------------------

My fix is a bit ugly, but works:

; Fix a bug in CMUCL 20D.  It seems sad to test (reverse "") twice, but
; attempts to avoid that produced warnings about variable *our-old-reverse*
; being undefined, even when using with-compilation-unit.
#+cmucl
(progn
  (when (null (ignore-errors (reverse "")))
    (defconstant *our-old-reverse* (symbol-function 'reverse)))
  (without-package-locks
   (when (null (ignore-errors (reverse "")))
     (defun reverse (x)
       (if (equal x "")
           ""
         (funcall *our-old-reverse* x)))
     (compile 'reverse))))

Notice also the message above about about "Source file no longer
exists".  I wonder if that's related to the first bug.

Thank you.  I really home someone can point me to a simple workaround
for the first bug.

Regards,
Matt Kaufmann


More information about the cmucl-help mailing list