Skip to content

Commit

Permalink
0.7.13.4:
Browse files Browse the repository at this point in the history
        Fix the bug 239.
  • Loading branch information
Alexey Dejneka committed Feb 26, 2003
1 parent d68f3f8 commit f294da0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 25 deletions.
21 changes: 0 additions & 21 deletions BUGS
Expand Up @@ -1273,27 +1273,6 @@ WORKAROUND:
compiler gets its hands on the code needing compilation from the REPL,
it has been macroexpanded several times.

239:
Since 0.7.0:
(defun foo (bit-array-2 &optional result-bit-array)
(declare (type (array bit) bit-array-2)
(type (or (array bit) (member t nil)) result-bit-array))
(unless (simple-bit-vector-p bit-array-2)
(multiple-value-call
(lambda (data1 start1)
(multiple-value-call
(lambda (data2 start2)
(multiple-value-call
(lambda (data3 start3)
(declare (ignore start3))
(print (list data1 data2)))
(values 0 0)))
(values bit-array-2 0)))
(values 444 0))))

Then (foo (make-array 4 :element-type 'bit :adjustable t) nil)
must return the same value as it prints, but it returns random garbage.

240:
"confused lexical/special warnings in MULTIPLE-VALUE-BIND"
(from tonyms on #lisp IRC 2003-02-25)
Expand Down
7 changes: 5 additions & 2 deletions src/compiler/debug.lisp
Expand Up @@ -963,7 +963,8 @@
(ref (print-leaf (ref-leaf node)))
(basic-combination
(let ((kind (basic-combination-kind node)))
(format t "~(~A ~A~) c~D"
(format t "~(~A~A ~A~) c~D"
(if (node-tail-p node) "tail " "")
(if (fun-info-p kind) "known" kind)
(type-of node)
(cont-num (basic-combination-fun node)))
Expand All @@ -981,7 +982,9 @@
(print-continuation (block-start (if-alternative node))))
(bind
(write-string "bind ")
(print-leaf (bind-lambda node)))
(print-leaf (bind-lambda node))
(when (functional-kind (bind-lambda node))
(format t " ~S ~S" :kind (functional-kind (bind-lambda node)))))
(creturn
(format t "return c~D " (cont-num (return-result node)))
(print-leaf (return-lambda node)))
Expand Down
11 changes: 10 additions & 1 deletion src/compiler/locall.lisp
Expand Up @@ -944,12 +944,21 @@
(cond ((not return))
((or next-block call-return)
(unless (block-delete-p (node-block return))
(when (and (node-tail-p call)
call-return
(not (eq (node-cont call)
(return-result call-return))))
;; We do not care to give a meaningful continuation to
;; a tail combination, but here we need it.
(delete-continuation-use call)
(add-continuation-use call (return-result call-return)))
(move-return-uses fun call
(or next-block (node-block call-return)))))
(t
(aver (node-tail-p call))
(setf (lambda-return call-fun) return)
(setf (return-lambda return) call-fun))))
(setf (return-lambda return) call-fun)
(setf (lambda-return fun) nil))))
(move-let-call-cont fun)
(values))

Expand Down
23 changes: 23 additions & 0 deletions tests/compiler-1.impure-cload.lisp
Expand Up @@ -202,4 +202,27 @@
(assert (raises-error? (bug231b 0 1.5) type-error))
(assert (raises-error? (bug231b 0 0) type-error))

;;; A bug appeared in flaky7_branch. Python got lost in unconverting
;;; embedded tail calls during let-convertion.
(defun bug239 (bit-array-2 &optional result-bit-array)
(declare (type (array bit) bit-array-2)
(type (or (array bit) (member t nil)) result-bit-array))
(unless (simple-bit-vector-p bit-array-2)
(multiple-value-call
(lambda (data1 start1)
(multiple-value-call
(lambda (data2 start2)
(multiple-value-call
(lambda (data3 start3)
(declare (ignore start3))
(print (list data1 data2)))
(values 0 0)))
(values bit-array-2 0)))
(values 444 0))))
(assert (equal (bug239 (make-array 4 :element-type 'bit
:adjustable t
:initial-element 0)
nil)
'(444 #*0000)))

(sb-ext:quit :unix-status 104) ; success
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -18,4 +18,4 @@
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)

"0.7.13.3"
"0.7.13.4"

0 comments on commit f294da0

Please sign in to comment.