From dbcca06d216201506c20cb3b3aa2524e46fbb746 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 19 Mar 2018 06:59:27 -0700 Subject: compiler: bug: inappropriate clobber in block. * share/txr/stdlib/compiler.tl (compiler comp-block): Don't use bfrag.oreg as the output register of block. Firstly, bfrag.oreg might be (t 0) which is read-only. Worse, bfrag.oreg could just be a variable from which the block obtains its return value; we mustn't clobber that location with block's dynamic return value. Not only mustn't but possibly we cannot: the location could be out of scope! --- share/txr/stdlib/compiler.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 4c5eb7e5..d7f11229 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -202,8 +202,8 @@ (let* ((nreg (if name me.(get-dreg name) '(t 0))) (bfrag me.(comp-progn oreg env body)) (lskip (gensym "l"))) - (new (frag bfrag.oreg - ^((block ,bfrag.oreg ,dreg ,lskip) + (new (frag oreg + ^((block ,oreg ,nreg ,lskip) ,*bfrag.code (end ,bfrag.oreg) ,lskip) -- cgit v1.2.3