From f7075b24f66c63756e6eece2477a9ecc599324d1 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 23 Sep 2014 22:09:35 +0800 Subject: [PATCH] py2llvm: fix exception matching --- artiq/py2llvm/ast_body.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/artiq/py2llvm/ast_body.py b/artiq/py2llvm/ast_body.py index 5e9ea6234..16a3698f8 100644 --- a/artiq/py2llvm/ast_body.py +++ b/artiq/py2llvm/ast_body.py @@ -299,14 +299,19 @@ class Visitor: else: if isinstance(handler.type, ast.Tuple): match = self.builder.icmp( - lc.ICMP_EQ, eid, handler.type.elts[0].args[0].n) + lc.ICMP_EQ, eid, + lc.Constant.int(lc.Type.int(), + handler.type.elts[0].args[0].n)) for elt in handler.type.elts[1:]: match = self.builder.or_( match, - self.builder.icmp(lc.ICMP_EQ, eid, elt.args[0].n)) + self.builder.icmp( + lc.ICMP_EQ, eid, + lc.Constant.int(lc.Type.int(), elt.args[0].n))) else: match = self.builder.icmp( - lc.ICMP_EQ, eid, handler.type.args[0].n) + lc.ICMP_EQ, eid, + lc.Constant.int(lc.Type.int(), handler.type.args[0].n)) self.builder.cbranch(match, handled_exc_block, cont_exc_block) self.builder.position_at_end(handled_exc_block) self.builder.store(lc.Constant.int(lc.Type.int(1), 0), propagate)