Inlined apply causes NIL sb-c::cleanup

Bug #404441 reported by John Fremlin on 2009-07-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

This is a test case for the bug reported by Leslie Polzer when SBCL compiles cl-cont. http://<email address hidden>/msg00243.html

The value NIL is not of type SB-C::CLEANUP.
   [Condition of type TYPE-ERROR]

cl-cont has been modified to not inline the funcall/cc function on SBCL, so the bug is made invisible.

This test case does not use cl-cont. It takes the output of cl-cont for this loop
(with-call/cc
      (loop for i in (list 1))
tidies it up and puts it in a standalone env.

The result is

$ sbcl --load /tmp/sbcleanup-bug.lisp
This is SBCL 1.0.29.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

debugger invoked on a TYPE-ERROR in thread #<THREAD "initial thread" RUNNING {1002A57C21}>:
  The value NIL is not of type SB-C::CLEANUP.

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

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Ignore runtime option --load "/tmp/sbcleanup-bug.lisp".
  1: [ABORT ] Skip rest of --eval and --load options.
  2: Skip to toplevel READ/EVAL/PRINT loop.
  3: [QUIT ] Quit SBCL (calling #'QUIT, killing the process).

(SB-C::EMIT-CLEANUPS
 #<SB-C::CBLOCK 5 :START c1 {1002ABC9C1}>
 #<SB-C::CBLOCK 3 :START c2 {1002B861D1}>)
0] backtrace

0: (SB-C::EMIT-CLEANUPS
    #<SB-C::CBLOCK 5 :START c1 {1002ABC9C1}>
    #<SB-C::CBLOCK 3 :START c2 {1002B861D1}>)
1: (SB-C::FIND-CLEANUP-POINTS #<SB-C:COMPONENT :NAME "LAMBDA NIL" {1002AFE1E1}>)
2: (SB-C::PHYSENV-ANALYZE #<SB-C:COMPONENT :NAME "LAMBDA NIL" {1002AFE1E1}>)
3: (SB-C::COMPILE-COMPONENT #<SB-C:COMPONENT :NAME "LAMBDA NIL" {1002AFE1E1}>)
4: (SB-C::%COMPILE
    (LAMBDA ()
      (DECLARE (MUFFLE-CONDITIONS COMPILER-NOTE))
      (PROGN
       (LET ((G1680 #'VALUES))
         (DECLARE (IGNORABLE G1680))
         (FUNCALL (LAMBDA # # # #) (MAKE-FUNCALLABLE #)))))
    #<SB-C::CORE-OBJECT >)[:EXTERNAL]
5: ((LAMBDA ()))
6: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK))
7: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-RECURSIVE-LOCK]291))
8: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK
    #<CLOSURE (FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK) {7FFFF517F4C9}>
    #S(SB-THREAD:MUTEX
       :NAME "World Lock"
       :%OWNER #<SB-THREAD:THREAD "initial thread" RUNNING {1002A57C21}>
       :STATE 1))
9: (SB-C::%WITH-COMPILATION-UNIT #<CLOSURE (LAMBDA #) {1003643889}>)[:EXTERNAL]
10: (SB-C::ACTUALLY-COMPILE
     NIL
     (LAMBDA ()
       (DECLARE (MUFFLE-CONDITIONS COMPILER-NOTE))
       (PROGN
        (LET ((G1680 #'VALUES))
          (DECLARE (IGNORABLE G1680))
          (FUNCALL (LAMBDA # # # #) (MAKE-FUNCALLABLE #)))))
     #<NULL-LEXENV>)
11: (SB-C:COMPILE-IN-LEXENV
     NIL
     (LAMBDA ()
       (DECLARE (MUFFLE-CONDITIONS COMPILER-NOTE))
       (PROGN
        (LET ((G1680 #'VALUES))
          (DECLARE (IGNORABLE G1680))
          (FUNCALL (LAMBDA # # # #) (MAKE-FUNCALLABLE #)))))
     #<NULL-LEXENV>)
12: (SB-IMPL::%SIMPLE-EVAL
     (LET ((G1680 #'VALUES))
       (DECLARE (IGNORABLE G1680))
       (FUNCALL
        (LAMBDA (&OPTIONAL G1681 &REST G1682)
          (DECLARE (IGNORABLE G1681))
          (DECLARE (IGNORE G1682))
          (FUNCALL (LAMBDA # # # #) NIL))
        (MAKE-FUNCALLABLE
         (LAMBDA (G1691 I LOOP-LIST-1679)
           (DECLARE #)
           (DECLARE #)
           (LABELS #
             #)))))
     #<NULL-LEXENV>)
13: (SB-INT:SIMPLE-EVAL-IN-LEXENV
     (LET ((G1680 #'VALUES))
       (DECLARE (IGNORABLE G1680))
       (FUNCALL
        (LAMBDA (&OPTIONAL G1681 &REST G1682)
          (DECLARE (IGNORABLE G1681))
          (DECLARE (IGNORE G1682))
          (FUNCALL (LAMBDA # # # #) NIL))
        (MAKE-FUNCALLABLE
         (LAMBDA (G1691 I LOOP-LIST-1679)
           (DECLARE #)
           (DECLARE #)
           (LABELS #
             #)))))
     #<NULL-LEXENV>)
14: (SB-FASL::LOAD-AS-SOURCE
     #<SB-SYS:FD-STREAM for "file /tmp/sbcleanup-bug.lisp" {10035773B1}>
     NIL
     NIL)

Changed in sbcl:
status: New → Confirmed
importance: Undecided → Medium
Stas Boukarev (stassats) wrote :

Can't reproduce anymore.

Changed in sbcl:
status: Confirmed → Incomplete

Appears to have been fixed in commit 74d229783cb6a2d3d972732d3ea10facd55f6f5d (1.0.47.15: %FUNCALL IR1 translator macroexpands the function form), the comment for which beings "Code compiled correctly without this".

I don't understand why this commit fixes this issue, however, and the size of the test case doesn't make things simple, either.

Paul F. Dietz (paul-f-dietz) wrote :

This was showing up previously in the random tester, but is not showing up now.

Stas Boukarev (stassats) wrote :

In ab242b1489d09e144de6efacea2eba359d68b9cb

Changed in sbcl:
status: Incomplete → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers