"The value NIL is not of type (AND ATOM (NOT NULL))" from SB-C::LVAR-USE

Bug #1276282 reported by Attila Lendvai on 2014-02-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
High
Unassigned

Bug Description

SBCL 1.1.15.25-c349498

calling:

(compile-file "/tmp/x.lisp")

on the attached file errors out from the compiler with:

The value NIL is not of type (AND ATOM (NOT NULL)).
   [Condition of type TYPE-ERROR]

Restarts:
 2: RETRY Retry SLIME REPL evaluation request.
 1: *ABORT Return to SLIME's top level.
 0: ABORT Abort thread (#<THREAD "repl-thread" RUNNING {1006938063}>)

Backtrace:
  0: (SB-C::LVAR-USE #<SB-C::LVAR 1 {10072D3AD3}>)
      Locals:
        SB-DEBUG::ARG-0 = #<SB-C::LVAR 1 {10072D3AD3}>
  1: ((FLET SB-C::CLOSURE-NEEDING-IR1-ENVIRONMENT-FROM-NODE :IN SB-C::FILTER-LVAR))
      [Nothing here]
  2: (SB-C::%WITH-IR1-ENVIRONMENT-FROM-NODE #<SB-ALIEN:CAST :%TYPE-CHECK T :VALUE #<SB-C::LVAR 2 {10072D2783}> :ASSERTED-TYPE #1=#<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> :TYPE-TO-CHECK #1# {1006F03433}> #..
      Locals:
        SB-DEBUG::ARG-0 = #<SB-ALIEN:CAST :%TYPE-CHECK T :VALUE #<SB-C::LVAR 2 {10072D2783}> :ASSERTED-TYPE #<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> :TYPE-TO-CHECK #<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> {1006F03433}>
        SB-DEBUG::ARG-1 = #<CLOSURE (FLET SB-C::CLOSURE-NEEDING-IR1-ENVIRONMENT-FROM-NODE :IN SB-C::FILTER-LVAR) {10072D2E9B}>
  3: (SB-C::FILTER-LVAR #<SB-C::LVAR 2 {10072D2783}> (SB-C::%COMPILE-TIME-TYPE-ERROR (QUOTE SB-C::DUMMY) (QUOTE CHARACTER) (QUOTE (VALUES (INTEGER -55 1114056) &OPTIONAL)) (QUOTE ((CHAR-CODE (+ 10 (- COMMO..
      Locals:
        SB-DEBUG::ARG-0 = #<SB-C::LVAR 2 {10072D2783}>
        SB-DEBUG::ARG-1 = (SB-C::%COMPILE-TIME-TYPE-ERROR 'SB-C::DUMMY 'CHARACTER '(VALUES (INTEGER -55 1114056) &OPTIONAL) '((CHAR-CODE (+ 10 #)) (+ (SB-EXT:TRULY-THE # SB-C::Y) 10)))
  4: (SB-C::IR1-OPTIMIZE-CAST #<SB-ALIEN:CAST :%TYPE-CHECK T :VALUE #<SB-C::LVAR 2 {10072D2783}> :ASSERTED-TYPE #1=#<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> :TYPE-TO-CHECK #1# {1006F03433}> NIL)
      Locals:
        CAST = #<SB-ALIEN:CAST :%TYPE-CHECK T :VALUE #<SB-C::LVAR 2 {10072D2783}> :ASSERTED-TYPE #<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> :TYPE-TO-CHECK #<SB-KERNEL:CHARACTER-SET-TYPE CHARACTER> {1006F03433}>
        DO-NOT-OPTIMIZE = NIL
  5: (SB-C::IR1-OPTIMIZE-BLOCK #<SB-C::CBLOCK NIL :START c3 {10072071B3}>)
      Locals:
        SB-DEBUG::ARG-0 = #<SB-C::CBLOCK NIL :START c3 {10072071B3}>
  6: (SB-C::IR1-OPTIMIZE #<SB-C:COMPONENT :NAME (LABELS COMMON-LISP-USER::NEXT :IN COMMON-LISP-USER::BUG) :REANALYZE T {10070CC303}> NIL)
  7: (SB-C::IR1-OPTIMIZE-UNTIL-DONE #<SB-C:COMPONENT :NAME (LABELS COMMON-LISP-USER::NEXT :IN COMMON-LISP-USER::BUG) :REANALYZE T {10070CC303}>)
  8: (SB-C::IR1-PHASES #<SB-C:COMPONENT :NAME (LABELS COMMON-LISP-USER::NEXT :IN COMMON-LISP-USER::BUG) :REANALYZE T {10070CC303}>)
  9: (SB-C::COMPILE-COMPONENT #<SB-C:COMPONENT :NAME (LABELS COMMON-LISP-USER::NEXT :IN COMMON-LISP-USER::BUG) :REANALYZE T {10070CC303}>)
 10: (SB-C::%COMPILE (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-USER::BUG (LABELS ((COMMON-LISP-USER::NEXT (&OPTIONAL (COMMON-LIS..
 11: (SB-C::FOPCOMPILE-FUNCTION (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-USER::BUG (LABELS ((COMMON-LISP-USER::NEXT (&OPTIONAL ..
 12: (SB-C::FOPCOMPILE (SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-USER::BUG (LABEL..
 13: (SB-C::CONVERT-AND-MAYBE-COMPILE (SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-U..
 14: ((FLET SB-C::DEFAULT-PROCESSOR :IN SB-C::PROCESS-TOPLEVEL-FORM) (SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (..
 15: (SB-C::PROCESS-TOPLEVEL-FORM (SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-USER:..
 16: (SB-C::PROCESS-TOPLEVEL-PROGN ((SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (BLOCK COMMON-LISP-USE..
 17: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN (QUOTE COMMON-LISP-USER::BUG) (SB-INT:NAMED-LAMBDA COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE..
 18: (SB-C::PROCESS-TOPLEVEL-PROGN ((EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN (QUOTE COMMON-LISP-USER::BUG) (QUOTE NIL) T)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN (QUOTE COMMON-LI..
 19: (SB-C::PROCESS-TOPLEVEL-FORM (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN (QUOTE COMMON-LISP-USER::BUG) (QUOTE NIL) T)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN (QUOTE COMM..
 20: ((FLET SB-C::DEFAULT-PROCESSOR :IN SB-C::PROCESS-TOPLEVEL-FORM) (DEFUN COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (LABELS ((COMMON-LISP-USER::NEXT (&OPTIONAL (COMMO..
 21: (SB-C::PROCESS-TOPLEVEL-FORM (DEFUN COMMON-LISP-USER::BUG (COMMON-LISP-USER::INPUT) (DECLARE (OPTIMIZE (DEBUG 3))) (LABELS ((COMMON-LISP-USER::NEXT (&OPTIONAL (COMMON-LISP-USER::ERROR-AT-EOF T)) (LET ..
 22: (SB-C::SUB-SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
 23: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN SB-C::SUB-COMPILE-FILE))
 24: ((FLET #:WITHOUT-INTERRUPTS-BODY-566 :IN SB-THREAD::CALL-WITH-RECURSIVE-LOCK))
 25: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK #<CLOSURE (FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN SB-C::SUB-COMPILE-FILE) {7FFFF4AA574B}> #<SB-THREAD:MUTEX "World Lock" owner: #<SB-THREAD:THREAD "repl-thr..
 26: ((LAMBDA NIL :IN SB-C::SUB-COMPILE-FILE))
 27: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
 28: (SB-C::SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
 29: (COMPILE-FILE "/tmp/x.lisp" :OUTPUT-FILE NIL :VERBOSE NIL :PRINT NIL :EXTERNAL-FORMAT :DEFAULT :TRACE-FILE NIL :BLOCK-COMPILE NIL :EMIT-CFASL NIL)

Attila Lendvai (attila-lendvai) wrote :
Stas Boukarev (stassats) wrote :

Reduced test-case:

(defun a (x)
  (char-code (+ 1 x)))

And (+ x 1) doesn't fail.

Changed in sbcl:
status: New → Triaged
importance: Undecided → High
Stas Boukarev (stassats) wrote :

So, commutative-arg-swap wraps the non-constant argument into (truly-the (lvar-type y) y), and NUMERIC-TYPE is not dumpable when it appears in the error message. I'm not quite sure why does it need to wrap with truly-the.

Without TRULY-THE, we often get non-ideal later transforms after commutation: type information is lost because we have to let convert everything and reflow types through.

Might be a win to just swap the combination's argument list in place.

Stas Boukarev (stassats) wrote :

In feb31fb6cfc8f89e2d75b5f2cc2ee569ac975033.

Changed in sbcl:
status: Triaged → 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

Bug attachments