The current type checker (analog or atomic) validates index types but not index ranges. Out of bounds access on registers or lists are not caught during static analysis. Example:
r = qreg[2]
x = r[5]
This code is invalid because it is attempting to access index 5 of a register with 2 values. However, this is not caught by the static analysis. This code will fail during runtime as the error is not caught during compile time. By implementing proper bounds checking, out of bounds access can be caught during program compilation.
The current type checker (analog or atomic) validates index types but not index ranges. Out of bounds access on registers or lists are not caught during static analysis. Example:
This code is invalid because it is attempting to access index 5 of a register with 2 values. However, this is not caught by the static analysis. This code will fail during runtime as the error is not caught during compile time. By implementing proper bounds checking, out of bounds access can be caught during program compilation.