Skip to content
Permalink
Browse files

Fix byte code verification error in edge case.

  • Loading branch information...
Ferada committed Jun 1, 2017
1 parent 4b6cbb1 commit 4630bfd27e534bb3e7f0e596cec237c6e5200d6f
Showing with 18 additions and 3 deletions.
  1. +5 −3 src/org/armedbear/lisp/compiler-pass2.lisp
  2. +13 −0 test/lisp/abcl/misc-tests.lisp
@@ -6846,8 +6846,6 @@ We need more thought here.
t)

(defun p2-throw (form target representation)
;; FIXME What if we're called with a non-NIL representation?
(declare (ignore representation))
(with-operand-accumulation
((emit-thread-operand)
(compile-operand (second form) nil) ; Tag.
@@ -6857,7 +6855,11 @@ We need more thought here.
(lisp-object-arg-types 2) nil))
;; Following code will not be reached.
(when target
(emit-push-nil)
(ecase representation
((:int :boolean :char)
(emit 'iconst_0))
((nil)
(emit-push-nil)))
(emit-move-from-stack target)))

(defun p2-unwind-protect-node (block target)
@@ -135,3 +135,16 @@
(deftest nth.inlined.1
(prog1 T (compile NIL (lambda (list) (nth (lambda ()) list))))
T)

;; these used to fail during byte code verification
(deftest throw.representation.1
(prog1 T (compile NIL (lambda () (eql (the fixnum (throw 'foo 42)) 2))))
T)

(deftest throw.representation.2
(prog1 T (compile NIL (lambda () (char-code (the character (throw 'foo 42))))))
T)

(deftest throw.representation.3
(prog1 T (compile NIL (lambda () (if (the boolean (throw 'foo 42)) 1 2))))
T)

0 comments on commit 4630bfd

Please sign in to comment.
You can’t perform that action at this time.