forked from M-Labs/artiq
1
0
Fork 0

transforms.llvm_ir_generator: don't crash when quoting empty lists.

This commit is contained in:
whitequark 2015-12-30 15:47:57 +08:00
parent 5dcf936f4e
commit ac3a170c8f
1 changed files with 2 additions and 1 deletions

View File

@ -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