From 2e460b97b99a36f4defe72b82c23e168a4ad2bed Mon Sep 17 00:00:00 2001 From: gerd <gerd> Date: Thu, 9 Oct 2003 11:12:32 +0000 Subject: [PATCH] (funcall (compile nil '(lambda (a b c) (declare (optimize (speed 0) (debug 0))) (logcount (let ((v3 (if a (block b3 a) b))) c)))) 46611128 -69 -133775) => segmentation violation * src/compiler/byte-comp.lisp (output-branch): Always emit conditional branches even if they go to the following instruction, because conditional branches have the side effect of popping the eval stack. Reported by Paul Dietz. --- compiler/byte-comp.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/byte-comp.lisp b/compiler/byte-comp.lisp index ec1bc25a5..1d6983dff 100644 --- a/compiler/byte-comp.lisp +++ b/compiler/byte-comp.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/byte-comp.lisp,v 1.40 2003/09/26 15:38:12 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/byte-comp.lisp,v 1.41 2003/10/09 11:12:32 gerd Exp $") ;;; ;;; ********************************************************************** ;;; @@ -143,10 +143,12 @@ segment 2 1 #'(lambda (segment posn delta) (declare (ignore segment) (type index posn delta)) - (when (zerop (- (new-assem:label-position label posn delta) - posn 2)) + (when (and (eql kind byte-branch-always) + (zerop (- (new-assem:label-position label posn delta) + posn 2))) ;; Don't emit anything, because the branch is to the following - ;; instruction. + ;; instruction. Only do this for unconditional branches, + ;; because the conditional ones pop the byte stack. t)) #'(lambda (segment posn) ;; We know we fit in one byte. -- GitLab