From 21a99370491be765e69f4b434ae7d24f10f83caf Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 10 Feb 2021 14:54:46 -0800 Subject: 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. --- share/txr/stdlib/compiler.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))) -- cgit v1.2.3