summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-19 06:59:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-19 06:59:27 -0700
commitdbcca06d216201506c20cb3b3aa2524e46fbb746 (patch)
tree0dcaa4075efb18f0721e0d5113c570273c2251d1
parentf79d41823aa5c266e356fa0b792ad5cc58162d7d (diff)
downloadtxr-dbcca06d216201506c20cb3b3aa2524e46fbb746.tar.gz
txr-dbcca06d216201506c20cb3b3aa2524e46fbb746.tar.bz2
txr-dbcca06d216201506c20cb3b3aa2524e46fbb746.zip
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!
-rw-r--r--share/txr/stdlib/compiler.tl4
1 files 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)