diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-11-02 00:36:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-11-02 00:36:34 -0700 |
commit | 6fe5ed2648e3a9014a03997ca617595f2a78e9b0 (patch) | |
tree | f351103c67cd0044eb79506c8620aea3c638969f /tests/012/oop-mi.tl | |
parent | 7889af8ff0eb30aa4e8657fe336af92abd571b5f (diff) | |
download | txr-6fe5ed2648e3a9014a03997ca617595f2a78e9b0.tar.gz txr-6fe5ed2648e3a9014a03997ca617595f2a78e9b0.tar.bz2 txr-6fe5ed2648e3a9014a03997ca617595f2a78e9b0.zip |
compiler: catch bugfix.
Commit c8f12ee44d226924b89cdd764b65a5f6a4030b81 tried to fix
an aspect of this problem. I ran into an issue where the try
code produced a D register as its output, and this was
clobbered by the catch code. In fact, the catch code simply
must not clobber the try fragment's output register. No matter
what register that is, it is not safe. A writable T register
could hold a variable.
For instance, this infinitely looping code is miscompiled
such that it terminates:
(let ((x 42))
(while (eql x 42)
(catch
(progn (throw 'foo)
x)
(foo () 0))))
When the exception is caught by the (foo () 0) clause
x is overwritten with that 0 value.
The variable x is assigned to a register like t13,
and since the progn form returns x as it value, it
compiles to a fragment (tfrag) which indicates t13
as its output register.
The catch code wrongly borrows ohis as its own output
register, placing the 0 value into it.
* stdlib/compiler.tl (compiler comp-catch): Get rid of the
coreg local variable, replacing all its uses with oreg.
Diffstat (limited to 'tests/012/oop-mi.tl')
0 files changed, 0 insertions, 0 deletions