Patent ID: 8484613

Claim:
A computer-executed method for adding bounds-checking instructions, the method comprising: receiving one or more instructions which when executed evaluate a first expression whose value is required to be between a lower bound expression's value and an upper bound expression's value, wherein at least one of the first expression's value, the lower bound expression's value, or the upper bound expression's value is not determinable before execution of the one or more instructions; in response to determining, using computer algebra, that the first expression's value is not guaranteed to be between the lower bound expression's value and the upper bound expression's value, adding bounds-checking instructions to the one or more instructions, wherein during execution of the one or more instructions, the bounds-checking instructions determine whether the first expression's value is between the lower bound expression's value and the upper bound expression's value; and in response to determining, using computer algebra, that the first expression's value is guaranteed to be between the lower bound expression's value and the upper bound expression's value, not adding bounds-checking instructions to the one or more instructions.