Make ir1-convert-hairy-lambda safe for non-local exits.
authorStas Boukarev <stassats@gmail.com>
Sun, 19 May 2013 16:37:27 +0000 (20:37 +0400)
committerStas Boukarev <stassats@gmail.com>
Sun, 19 May 2013 16:37:27 +0000 (20:37 +0400)
The function it calls may throw a tag, locall-already-let-converted,
which will leave a partially initialized optional-dispatch structure
in new-functionals of the current component, which may cause problems
down the line.

Fixes lp#1180992.

Also add a test-case for f3a2cd.. "Add a stub for %other-pointer-p.".

NEWS
src/compiler/ir1tran-lambda.lisp
tests/compiler.pure.lisp
tests/seq.pure.lisp

diff --git a/NEWS b/NEWS
index d9c5615..2b413ca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,8 @@ changes relative to sbcl-1.1.7:
     codegen errors: type checks are inserted as necessary. (lp#1177703)
   * bug fix: Unsigned modular arithmetic is correctly converted into signed
     modular arithemtic (mostly to exploit fixnum-width VOPs). (lp#1026634)
+  * bug fix: a combination of inlined local function with &optional and
+    recursion no longer causes undescriptive compiler errors. (lp#1180992)
   * optimization: faster ISQRT on fixnums and small bignums
   * optimization: faster and smaller INTEGER-LENGTH on fixnums on x86-64.
   * optimization: On x86-64, the number of multi-byte NOP instructions used
index 10e2b08..ce06727 100644 (file)
                                                ,*current-path*))))
         (min (or (position-if #'lambda-var-arg-info vars) (length vars))))
     (aver-live-component *current-component*)
-    (push res (component-new-functionals *current-component*))
     (ir1-convert-hairy-args res () () () () vars nil body aux-vars aux-vals
                             source-name debug-name nil post-binding-lexenv
                             system-lambda)
+    ;; ir1-convert-hairy-args can throw 'locall-already-let-converted
+    ;; push optional-dispatch into the current component only after it
+    ;; normally returned
+    (push res (component-new-functionals *current-component*))
     (setf (optional-dispatch-min-args res) min)
     (setf (optional-dispatch-max-args res)
           (+ (1- (length (optional-dispatch-entry-points res))) min))
index 6e1d150..7cced51 100644 (file)
                   (let ((hash #xD13CCD13))
                     (setf hash (logand most-positive-word
                                        (ash hash 5)))))))
+
+(with-test (:name (local-&optional-recursive-inline :bug-1180992))
+  (compile nil
+           `(lambda ()
+              (labels ((called (&optional a))
+                       (recursed (&optional b)
+                         (called)
+                         (recursed)))
+                (declare (inline recursed called))
+                (recursed)))))
+
index 78d9b27..ab38ed6 100644 (file)
                                          (declare (optimize safety))
                                          (elt args 0))))
                          sb-kernel:index-too-large-error)))
+
+(with-test (:name do-sequence-on-literals)
+  (assert (= (sequence:dosequence (e #(1 2 3)) (return e))
+             1)))