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
commit803827f743fb8abf8fdaf359a7686e3d1abc21d3 (patch)
tree0dcaa4075efb18f0721e0d5113c570273c2251d1
parent1a1c800a8ab6e0168f10f8cc68dffdd670ae64b3 (diff)
downloadtxr-803827f743fb8abf8fdaf359a7686e3d1abc21d3.tar.gz
txr-803827f743fb8abf8fdaf359a7686e3d1abc21d3.tar.bz2
txr-803827f743fb8abf8fdaf359a7686e3d1abc21d3.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)