diff --git a/python/cudaq/kernel/ast_bridge.py b/python/cudaq/kernel/ast_bridge.py index 01149411ba..5f566768c2 100644 --- a/python/cudaq/kernel/ast_bridge.py +++ b/python/cudaq/kernel/ast_bridge.py @@ -2397,8 +2397,11 @@ def bodyBuilder(iterVal): startOff = arith.SubIOp(qrSize, self.popValue()) dyna = IntegerAttr.get(self.getIntegerType(), -1) self.pushValue( - quake.SubVeqOp(self.getVeqType(), var, dyna, - dyna, lower=startOff, + quake.SubVeqOp(self.getVeqType(), + var, + dyna, + dyna, + lower=startOff, upper=endOff).result) else: # extract the qubit... @@ -2417,8 +2420,11 @@ def bodyBuilder(iterVal): offset = arith.SubIOp(qrSize, one) dyna = IntegerAttr.get(self.getIntegerType(), -1) self.pushValue( - quake.SubVeqOp(self.getVeqType(), var, dyna, - dyna, lower=zero, + quake.SubVeqOp(self.getVeqType(), + var, + dyna, + dyna, + lower=zero, upper=offset).result) else: # extract the qubit... @@ -2996,8 +3002,12 @@ def visit_Subscript(self, node): upperVal = arith.SubIOp(upperVal, self.getConstantInt(1)).result dyna = IntegerAttr.get(self.getIntegerType(), -1) self.pushValue( - quake.SubVeqOp(self.getVeqType(), var, dyna, dyna, - lower=lowerVal, upper=upperVal).result) + quake.SubVeqOp(self.getVeqType(), + var, + dyna, + dyna, + lower=lowerVal, + upper=upperVal).result) elif cc.StdvecType.isinstance(var.type): eleTy = cc.StdvecType.getElementType(var.type) ptrTy = cc.PointerType.get(self.ctx, eleTy)