summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-10 14:54:46 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-10 14:54:46 -0800
commit7a957692314786f988cf126fcc86aad2708d8ba7 (patch)
tree3371c97c6a176d9817b9e89a938964e5f3016a59
parent0d7d19d4761f1385a24e65082b10a46288e87f5a (diff)
downloadtxr-7a957692314786f988cf126fcc86aad2708d8ba7.tar.gz
txr-7a957692314786f988cf126fcc86aad2708d8ba7.tar.bz2
txr-7a957692314786f988cf126fcc86aad2708d8ba7.zip
compiler: bug: trivial unwind-protect return value
Bad test case: (unwind-protect 42 1 2 3) -> 3 ;; should be 42 * share/txr/stdlib/compiler.tl (compile comp-unwind-protect): In the case when the protected code compiles to zero code, because it is a simple variable or constant, the code that we return must still nominate the that fragment's output register as its output, and not the output register of the cleanup forms.
-rw-r--r--share/txr/stdlib/compiler.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 855b3004..045071dc 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -598,7 +598,7 @@
me.(free-treg treg)
(cond
((null pfrag.code)
- (new (frag cfrag.oreg
+ (new (frag pfrag.oreg
cfrag.code
cfrag.fvars
cfrag.ffuns)))