diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-01 12:02:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-01 12:02:52 -0700 |
commit | 91625692921a0e19799f386890bfa316816c9cf8 (patch) | |
tree | 289a74135c30a64ba8553222b358ca1d9438c50c /share | |
parent | 2c4403e48020fbf50f2fc3ad5e50ae5ecf69859f (diff) | |
download | txr-91625692921a0e19799f386890bfa316816c9cf8.tar.gz txr-91625692921a0e19799f386890bfa316816c9cf8.tar.bz2 txr-91625692921a0e19799f386890bfa316816c9cf8.zip |
compiler: bug: indirect function calls.
* share/txr/stdlib/compiler.tl (comp-call): We must not use
the output register oreg for compiling the expression which
calculates the function because it could be one of the
arguments. In that case, we clobber an argument before we
have called the function.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/compiler.tl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 57b56828..fc80d178 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -825,8 +825,10 @@ (defmeth compiler comp-call (me oreg env opcode args) (tree-bind (fform . fargs) args - (let* ((ffrag me.(compile oreg env fform)) + (let* ((foreg me.(alloc-treg)) + (ffrag me.(compile foreg env fform)) (cfrag me.(comp-call-impl oreg env opcode ffrag.oreg fargs))) + me.(free-treg foreg) (new (frag cfrag.oreg (append ffrag.code cfrag.code) |