From 3d977d0115fa1c884ada2e92dfbbc4e6d4364f4d Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Wed, 21 Sep 2022 17:16:50 +0900 Subject: [PATCH] Fix unwind offset value in return-from and go compilation (#494) --- lisp/comp/trans.l | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/comp/trans.l b/lisp/comp/trans.l index 9f0f2340e..3950a746a 100644 --- a/lisp/comp/trans.l +++ b/lisp/comp/trans.l @@ -656,13 +656,17 @@ (send self :store "w") ;save result (send self :reset-vsp) (if need-unwind - (maybe-format cfile " unwind(ctx,local+~d);~%" k)) + (if (zerop k) + (maybe-format cfile " unwind(ctx,local-1);~%") + (maybe-format cfile " unwind(ctx,local+~d);~%" (1- k)))) (maybe-format cfile " local[~d]=w;~%" k) (inc pushcount)) (:go-tag (k need-unwind) (send self :reset-vsp) (if need-unwind - (maybe-format cfile " unwind(ctx,local+~d);~%" k)) + (if (zerop k) + (maybe-format cfile " unwind(ctx,local-1);~%") + (maybe-format cfile " unwind(ctx,local+~d);~%" (1- k)))) (inc pushcount)) (:closure (lab env0 env1) (if env1