summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-16 01:53:16 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-16 01:53:16 -0700
commit1025ce941a8957b777545a4756a8b3cdfd16c242 (patch)
tree5ec107a2a0b96d2a4be447ea0b1923aa8eba10bc
parent9395eb5b00b1a5486a53c854866fd386256f6afb (diff)
downloadtxr-1025ce941a8957b777545a4756a8b3cdfd16c242.tar.gz
txr-1025ce941a8957b777545a4756a8b3cdfd16c242.tar.bz2
txr-1025ce941a8957b777545a4756a8b3cdfd16c242.zip
compiler: frame level mismatch bug.
Repro test case: (defvar v) (defun f (: (v v))) (call (compile 'f)) ;; blows up * share/txr/stdlib/compiler.tl (compiler comp-lambda): The specials variable is wrongly used as a Boolean to decide whether we need an extra environment level for specials. The problem occurs when all of the specials are optional parameters. Optionals are handled specially and removed from the specials list. If all the specials are optional parameters, then the special list becomes empty. This cannot be intepreted as "there are no specials". The correct Boolean which indicates "there are specials" is need-dframe.
-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 e76849db..ccdbee83 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -868,7 +868,7 @@
,*(whenlet ((spec-sub [find have-sym specials : cdr]))
(set specials [remq have-sym specials cdr])
^((bindv ,have-bind.loc ,me.(get-dreg (car spec-sub))))))))))
- (benv (if specials (new env up nenv co me) nenv))
+ (benv (if need-dframe (new env up nenv co me) nenv))
(btreg me.(alloc-treg))
(bfrag me.(comp-progn btreg benv body))
(boreg (if env.(out-of-scope bfrag.oreg) btreg bfrag.oreg))