From ac3a170c8fc14b4d9976840107ccd63c5ce8b272 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 30 Dec 2015 15:47:57 +0800 Subject: [PATCH] transforms.llvm_ir_generator: don't crash when quoting empty lists. --- artiq/compiler/transforms/llvm_ir_generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index fe121a610..95de66837 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -1055,7 +1055,8 @@ class LLVMIRGenerator: elt_type = builtins.get_iterable_elt(typ) llelts = [self._quote(value[i], elt_type, lambda: path() + [str(i)]) for i in range(len(value))] - lleltsary = ll.Constant(ll.ArrayType(llelts[0].type, len(llelts)), llelts) + lleltsary = ll.Constant(ll.ArrayType(self.llty_of_type(elt_type), len(llelts)), + llelts) llglobal = ll.GlobalVariable(self.llmodule, lleltsary.type, "quoted.list") llglobal.initializer = lleltsary