Merge branch 'fix-802' into develop

This commit is contained in:
Daniel Kochmański 2025-11-17 10:42:22 +01:00
commit bd64c52d7e
2 changed files with 30 additions and 6 deletions

View file

@ -91,15 +91,19 @@
(defun c2tagbody-body (body)
;;; INV: BODY is a list of tags and forms. We have processed the body
;;; so that the last element is always a form producing NIL.
(loop for (this-form next-form . rest) on body do
(loop for (this-form . rest) on body do
(cond ((tag-p this-form)
(wt-label (tag-jump this-form)))
((tag-p next-form)
(with-exit-label (*exit* (tag-jump next-form))
(let ((*destination* 'TRASH))
(c2expr this-form))))
((endp rest)
;; Last form, it is never a label!
(c2expr this-form))
(t
(c2expr this-form)))))
(let* ((next-form (first rest))
(maybe-tag (when (tag-p next-form)
(tag-jump next-form))))
(with-exit-label (*exit* maybe-tag)
(let ((*destination* 'TRASH))
(c2expr this-form))))))))
(defun c2go (c1form tag nonlocal)
(declare (ignore c1form))

View file

@ -2571,3 +2571,23 @@
(symbol-macrolet ((value -27))
(load-time-value
(block b4 (woosh b4 value))))))))))
;;; Date 2025-11-16
;;; URL: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/802
;;; Regression commit: 521e815158dc92e6b8af18d007808349764b5623
;;; Reported by: Jan Moringen
;;; Description
;;;
;;; Regression in TAGBODY handling by the C compiler.
;;;
(deftest cmp.0110.tagbody-regression ()
(is (eql 42
(funcall (compile nil
'(lambda (&aux (always-nil nil))
(block nil
(tagbody
:package
(when always-nil
(go :package))
:symbol
(return 42)))))))))