From e501fdc922d24207d4773c8a0bd8245bea3d636f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 1 Apr 2018 10:47:14 -0700 Subject: compiler: bugfix: incorrect jmp in catch. * share/txr/stdlib/compiler.tl (comp-catch): The emitted code doesn't handle the normal non-exception path. It assumes that only the frame established with the earlier frame instruction needs to be terminated; but in fact the catch intruction's frame has to be ended also. Thus we don't need the frame-end label; all exit cases jump too the handler-end label in front of the two end instructions. --- share/txr/stdlib/compiler.tl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index c8563bea..7a289290 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -521,7 +521,6 @@ (tfrag me.(compile oreg env try-expr)) (lhand (gensym "l")) (lhend (gensym "l")) - (lfrend (gensym "l")) (nclauses (len clauses)) (cfrags (collect-each ((cl clauses) (i (range 1))) @@ -547,12 +546,11 @@ ^((frame ,nenv.lev ,nenv.v-cntr) (catch ,esvb.loc ,eavb.loc ,me.(get-dreg symbols) ,lhand) ,*tfrag.code - (jmp ,lfrend) + (jmp ,lhend) ,lhand ,*(mappend .code cfrags) ,lhend (end ,tfrag.oreg) - ,lfrend (end ,tfrag.oreg)) (uni tfrag.fvars [reduce-left uni cfrags nil .fvars]) (uni tfrag.ffuns [reduce-left uni cfrags nil .ffuns]))))))) -- cgit v1.2.3