Failed to compile working code without declareing some functions notinline.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
SBCL version 1.2.4, using optima pattern matching library: https:/
Compiling file with this code will fail without declaring signal-error notinline.
(defun signal-error ()
(error 'error))
(defun will-fail ()
(optima:match 1
((not 2)
(signal-
Error report:
; compiling (DEFUN SIGNAL-ERROR ...)
; compiling (DEFUN WILL-FAIL ...)
; file: /home/freeman/
; in: DEFUN WILL-FAIL
; (OPTIMA:MATCH 1
; ((NOT 2) (COMMON-
; --> LET OPTIMA::%OR BLOCK SB-C::%
; ==>
; '((BLOCK #:BLOCK2
; (TAGBODY
; (RETURN-FROM #:BLOCK2
; (SYMBOL-MACROLET #
; #))
; #:FAIL3
; (RETURN-FROM #:BLOCK2 NIL)))
; (COMMON-
;
; caught ERROR:
; don't know how to dump 2 (default MAKE-LOAD-FORM method called).
; --> LET OPTIMA::%OR BLOCK
; ==>
; (SB-C::
; '((BLOCK #:BLOCK2
; (TAGBODY
; (RETURN-FROM #:BLOCK2 #)
; #:FAIL3
; (RETURN-FROM #:BLOCK2 NIL)))
; (COMMON-
;
; note: The fourth argument never returns a value.
Unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
The value NIL is not of type (AND ATOM (NOT NULL)).
After declaring singnal-error as notinline or changing ERROR to SIGNAL it'll compile ok.
This is partially the fault of optima and partially the failure of the compiler to stop processing when things go wrong when attempting to dump a constant object.
The root cause is: CORE:CONSTANT- PATTERN
caught ERROR:
; don't know how to dump 2 (default MAKE-LOAD-FORM method called).
This "2" is not the literal 2, but an OPTIMA.
If you put this in either your source code or the Optima source code, it fixes the problem:
(declare (ignore env))
(make- load-form- saving- slots self)))
(eval-when (:compile-toplevel)
(defmethod make-load-form ((self constant-pattern) &optional env)
As to why declaring the error signaling inline "fixes" the problem, it's because on account of the compiler knowing that ERROR does not return, there becomes some unreachable code, and that is the very same code which couldn't be dumped properly.