clasp-developers / clasp

clasp Common Lisp environment
https://clasp-developers.github.io/
2.58k stars 145 forks source link

serapeum compilation error #1365

Open ak-coram opened 2 years ago

ak-coram commented 2 years ago

Describe the bug Compilation of the serapeum library via quicklisp fails with the following error:

COMPILE-FILE-ERROR while
compiling #<CL-SOURCE-FILE "serapeum" "level1" "sequences">
   [Condition of type UIOP/LISP-BUILD:COMPILE-FILE-ERROR]

Restarts:
 0: [RETRY] Retry compiling #<CL-SOURCE-FILE "serapeum" "level1" "sequences">.
 1: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "serapeum" "level1" "sequences"> as having been successful.
 2: [RETRY] Retry ASDF operation.
 3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 4: [RETRY] Retry ASDF operation.
 5: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
 --more--

Backtrace:
  0: (UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<COMPILE-OP > . #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)))
  1: (ASDF/LISP-ACTION:PERFORM-LISP-COMPILATION #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
  2: ((METHOD ASDF/ACTION:PERFORM (ASDF/LISP-ACTION:COMPILE-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)) #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
  3: CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA
  4: ((LAMBDA ()))
  5: ((LAMBDA ()))
  6: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL)> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
  7: (ASDF/ACTION:CALL-WHILE-VISITING-ACTION #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences"> #<FUNCTION (LAMBDA NIL)>)
  8: ((METHOD ASDF/ACTION:PERFORM (:AROUND) (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<FUNCTION CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA> #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequ..
  9: (CLOS::EMF-FROM-CONTF.LAMBDA #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
 10: ((METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T)) #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
 11: ((METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (:AROUND) (T T)) #<FUNCTION (METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (T T))> #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
 12: (CLOS::EMF-FROM-CONTF.LAMBDA #<COMPILE-OP > #<CL-SOURCE-FILE "serapeum" "level1" "sequences">)
 13: ((METHOD ASDF/PLAN:PERFORM-PLAN (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN>)
 14: ((LAMBDA ()))
 15: (COMPILER::DO-COMPILATION-UNIT #<FUNCTION (LAMBDA NIL)>)
 16: ((LAMBDA (ASDF/PLAN:PLAN &KEY &ALLOW-OTHER-KEYS)) #<ASDF/PLAN:SEQUENTIAL-PLAN>)
 17: ((METHOD ASDF/PLAN:PERFORM-PLAN (:AROUND) (T)) #<FUNCTION (METHOD ASDF/PLAN:PERFORM-PLAN (T))> #<ASDF/PLAN:SEQUENTIAL-PLAN>)
 18: (CLOS::EMF-FROM-CONTF.LAMBDA #<ASDF/PLAN:SEQUENTIAL-PLAN>)
 19: ((METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<LOAD-OP > #<SYSTEM "serapeum"> :VERBOSE NIL)
 20: CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA
 21: ((LAMBDA ()))
 22: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL)> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
 23: ((LAMBDA (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT &REST ASDF/OPERATE::KEYS &KEY :ON-FAILURE ...)) #<LOAD-OP > #<SYSTEM "serapeum"> :VERBOSE NIL)
 24: ((METHOD ASDF/OPERATE:OPERATE (:AROUND) (T T)) #<FUNCTION CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA> #<LOAD-OP > #<SYSTEM "serapeum"> :VERBOSE NIL)
 25: (CLOS::EMF-FROM-CONTF.LAMBDA #<LOAD-OP > #<SYSTEM "serapeum"> :VERBOSE NIL)
 26: ((METHOD ASDF/OPERATE:OPERATE (SYMBOL T)) ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 27: CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA
 28: ((LAMBDA ()))
 29: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL)> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
 30: ((LAMBDA (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT &REST ASDF/OPERATE::KEYS &KEY :ON-FAILURE ...)) ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 31: ((METHOD ASDF/OPERATE:OPERATE (:AROUND) (T T)) #<FUNCTION CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA> ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 32: (CLOS::EMF-FROM-CONTF.LAMBDA ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 33: ((LAMBDA ()))
 34: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL)> :OVERRIDE T :KEY NIL :OVERRIDE-CACHE T :OVERRIDE-FORCING NIL)
 35: ((LAMBDA ()))
 36: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL)> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
 37: ((LAMBDA (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT &REST ASDF/OPERATE::KEYS &KEY :ON-FAILURE ...)) ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 38: ((METHOD ASDF/OPERATE:OPERATE (:AROUND) (T T)) #<FUNCTION CLOS::EFFECTIVE-METHOD-FUNCTION.LAMBDA> ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 39: (CLOS::EMF-FROM-CONTF.LAMBDA ASDF/LISP-ACTION:LOAD-OP "serapeum" :VERBOSE NIL)
 40: (ASDF/OPERATE:LOAD-SYSTEM "serapeum" :VERBOSE NIL)
 41: ((LAMBDA ()))
 42: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<FUNCTION (LAMBDA NIL)>)
 43: (QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY #<LOAD-STRATEGY "serapeum" (1 asdf, 0 quicklisp)>)
 44: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES :SERAPEUM :PROMPT NIL)
 45: ((FLET QUICKLISP-CLIENT::QL))
 46: ((METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<QL-IMPL:CLASP> #<FUNCTION (FLET QUICKLISP-CLIENT::QL)>)
 47: (QL-IMPL-UTIL:CALL-WITH-QUIET-COMPILATION #<FUNCTION (FLET QUICKLISP-CLIENT::QL)>)
 48: ((METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) :SERAPEUM)
 49: ((LAMBDA ()))
 50: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<FUNCTION (LAMBDA NIL)>)
 51: ((LAMBDA (QUICKLISP-CLIENT::SYSTEMS &KEY :EXPLAIN :PROMPT :VERBOSE &ALLOW-OTHER-KEYS)) :SERAPEUM)
 52: ((METHOD QUICKLISP-CLIENT:QUICKLOAD (:AROUND) (T)) #<FUNCTION (METHOD QUICKLISP-CLIENT:QUICKLOAD (T))> :SERAPEUM)
 53: (CLOS::EMF-FROM-CONTF.LAMBDA :SERAPEUM)
 54: (LABELS CLASP-CLEAVIR::RECURSE)
 55: (CLASP-CLEAVIR::SIMPLE-EVAL (QUICKLISP-CLIENT:QUICKLOAD :SERAPEUM) NIL #<STANDARD-GENERIC-FUNCTION CLASP-CLEAVIR::CCLASP-EVAL-WITH-ENV>)
 56: (CLASP-CLEAVIR::CCLASP-EVAL (QUICKLISP-CLIENT:QUICKLOAD :SERAPEUM) NIL)
 57: (EVAL (QUICKLISP-CLIENT:QUICKLOAD :SERAPEUM))
 58: (SWANK::%EVAL-REGION "(ql:quickload :serapeum)\n")
 59: ((LAMBDA ()))

Expected behavior The library is compiled and loaded without the error above.

Actual behavior The following errors are printed before the final error (above) is raised: debug.txt

Code at issue

(load #P"~/quicklisp/setup.lisp")
(ql:quickload :serapeum)

Context

Bike commented 2 years ago

The above backtrace is unfortunately not very helpful, since it's just ASDF saying there was an error while compiling, rather than the actual error. (edit: oops, didn't see debug.txt. my bad)

I tried quickloading serapeum just now and got a different error: The definition of cond-let uses trivia:match with backquotes, and it apparently gets confused by Eclector. I don't know how trivia works with backquotes, so I'm not sure if this is our problem or trivia's or what.

eta: actually, looks like the version in git is newer than my quicklisp's, and the new version doesn't use backquote. let me try something newer.

Bike commented 1 year ago

serapeum-free reproducer attached test.lisp.txt. compile-file it and there will be a similar verification failure.

The problem appears to be that clasp can't handle the complex type code that serapeum generates, which declares that a variable is both a simple-vector and simple-base-string (or whatever other vector type) which is impossible (nil type). Serapeum's code is valid, if weird, but Cleavir is choking on the impossibility anyway.

Bike commented 1 year ago

I think what's happening is that the schar call is being transformed (via deftransform) while dead, and recomputing the iblock flow order with dead iblocks around somehow screws things up. (In particular, commenting out the flow order recomputation and the interpolation in maybe-transform eliminates the problem.) To really fix this I think it would be best not to do interpolation, or at least not in the middle of meta-evaluate. But that'll be a huge change in the architecture.