block compile converted top level form error

Bug #1865336 reported by il71
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

OS: Windows 10 x86-64

$ sbcl --version
SBCL 2.0.2

$ cat t.lisp

#+(and)
(let ((f (cl-user::rt-sym :sb-gmp :uninstall-gmp-funs)))
  (when f
    (format t "Uninstall GMP functions~%")
    (funcall f)))

(defun fact (n &optional (p 1)) (if (zerop n) p (fact (1- n) (* p n))))

(print (time (integer-length (fact (expt 10 5)))))

$ cat q.lisp

(in-package :cl-user)

(defun rt-sym (package symbol)
  (let ((p (find-package package)))
    (when p
      (find-symbol (symbol-name symbol) p))))

(ignore-errors (require :sb-gmp))

(let ((f (rt-sym :sb-gmp :install-gmp-funs)))
  (when f
    (format t "Install GMP functions~%")
    (funcall f)))

(load (compile-file "t.lisp" :block-compile t))

## On linux:
$ sbcl --no-userinit --load q.lisp
Install GMP functions
; compiling file "/media/sf_ws/lisp/bench/q/t.lisp" (written 01 MAR 2020 06:32:32 PM):
; converting (LET (#) ...)
; converting (DEFUN FACT ...)
; converting (PRINT (TIME #))
; block compiling converted top level forms...

; wrote /media/sf_ws/lisp/bench/q/t.fasl
; compilation finished in 0:00:00.007
Uninstall GMP functions
Evaluation took:
  4.701 seconds of real time
  4.695745 seconds of total run time (4.591574 user, 0.104171 system)
  [ Run times consist of 0.194 seconds GC time, and 4.502 seconds non-GC time. ]
  99.89% CPU
  13,204,004,684 processor cycles
  9,925,321,808 bytes consed

1516705

## On windows:
$ sbcl --no-userinit --load q.lisp
Install GMP functions
; compiling file "D:/ws/lisp/bench/q/t.lisp" (written 01 MAR 2020 06:32:32 PM):
; converting (LET (#) ...)
; converting (DEFUN FACT ...)
; converting (PRINT (TIME #))
; block compiling converted top level forms...While evaluating the form starting at line 16, column 0
  of #P"D:/ws/lisp/bench/q/q.lisp":

debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {10010B00C3}>:
  The value
    NIL
  is not of type
    SB-C::NODE

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY ] Retry EVAL of current toplevel form.
  1: [CONTINUE] Ignore error and continue loading file "D:\\ws\\lisp\\bench\\q\\q.lisp".
  2: [ABORT ] Abort loading file "D:\\ws\\lisp\\bench\\q\\q.lisp".
  3: Ignore runtime option --load "q.lisp".
  4: Skip rest of --eval and --load options.
  5: Skip to toplevel READ/EVAL/PRINT loop.
  6: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).

(SB-C::MERGE-TOPLEVEL-LAMBDAS (#<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME (SB-C::TOP-LEVEL-FORM (LET (#) (WHEN F # #))) :KIND :TOPLEVEL :TYPE #1=#<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-only)> :WHERE-FROM :DEFINED :VARS NIL {10024EB8A3}> #<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME (SB-C::TOP-LEVEL-FORM (SB-IMPL::%DEFUN (QUOTE FACT) (SB-INT:NAMED-LAMBDA FACT # # #))) :KIND :TOPLEVEL :TYPE #1# :WHERE-FROM :DEFINED :VARS NIL {10024F0803}> #<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME (SB-C::TOP-LEVEL-FORM (PRINT (TIME #))) :KIND :TOPLEVEL :TYPE #1# :WHERE-FROM :DEFINED :VARS NIL {10024F6DF3}>))
0]

Revision history for this message
il71 (il71) wrote :

Actually it fails on linux too, I had sbcl-2.0.1 on linux.

Adding (in-package :cl-user) to t.lisp "fixes" the problem.

tags: removed: os-windows
summary: - block compile top level form error on windows
+ block compile converted top level form error
Stas Boukarev (stassats)
Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.