The value NIL is not of type SB-C::NODE.

Bug #720382 reported by 3b on 2011-02-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

(lambda (b) ((lambda () b) 1))

produces the error "The value NIL is not of type SB-C::NODE." during compilation, along with the expected warning about wrong number of arguments passed to the inner lambda.

Expected just the warning.

(lambda (b) (funcall (lambda () b) 1)) works as expected.

possibly related to bug #551227, but doesn't seem to fit the diagnosis there, so filing a separate bug.

tested on x8664 linux, and 1.0.36 x86 linux

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
status: Confirmed → Triaged
Nikodemus Siivola (nikodemus) wrote :

Not the same as bug #551227.

Differences between conversion of (FUNCALL #'(LAMBDA ...) ...) and ((LAMBDA ...) ...) are interesting, especially since the latter is specified to be semantically equivalent to the first.

I think just making the compiler treat the exactly as such by converting the latter into the first would be TRT.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
Nikodemus Siivola (nikodemus) wrote :

Note to self:

Just converting the ((LAMBDA ...) ...) to (FUNCALL (LAMBDA ...) ...) is not good -- at least not until the following is fixed:

  (compile nil
   `(lambda (x y)
      (declare (single-float x y))
      (+ x ((lambda (z) z) y)))))

 ; disassembly for (LAMBDA (X Y))
 ; 0485DF02: 0F28D9 MOVAPS XMM3, XMM1 ; no-arg-parsing entry point
 ; 05: F30F58DA ADDSS XMM3, XMM2
 ; 09: 66480F7EDA MOVD RDX, XMM3
 ; 0E: 48C1E220 SHL RDX, 32
 ; 12: 4883CA1A OR RDX, 26
 ; 16: 488BE5 MOV RSP, RBP
 ; 19: F8 CLC
 ; 1A: 5D POP RBP
 ; 1B: C3 RET

 ;; BAD
  (compile nil
   `(lambda (x y)
      (declare (single-float x y))
        (+ x (funcall (lambda (z) z) y)))))

 ; disassembly for (LAMBDA (X Y))
 ; 048E1BF8: 488D5C24F0 LEA RBX, [RSP-16] ; no-arg-parsing entry point
 ; BFD: 4883EC18 SUB RSP, 24
 ; C01: 488B55F0 MOV RDX, [RBP-16]
 ; C05: 488B0584FFFFFF MOV RAX, [RIP-124] ; #<FUNCTION (LAMBDA
                                                              ; #) ..>
 ; C0C: B908000000 MOV ECX, 8
 ; C11: 48892B MOV [RBX], RBP
 ; C14: 488BEB MOV RBP, RBX
 ; C1A: 480F42E3 CMOVB RSP, RBX
 ; C21: 488B55F8 MOV RDX, [RBP-8]
 ; C25: 4C8D1C25E0010020 LEA R11, [#x200001E0] ; GENERIC-+
 ; C2D: 41FFD3 CALL R11
 ; C30: 480F42E3 CMOVB RSP, RBX
 ; C34: 488BE5 MOV RSP, RBP
 ; C37: F8 CLC
 ; C38: 5D POP RBP
 ; C39: C3 RET

Changed in sbcl:
status: Triaged → In Progress
Nikodemus Siivola (nikodemus) wrote :

Changed in sbcl:
status: In Progress → Fix Committed
assignee: Nikodemus Siivola (nikodemus) → nobody
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