summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-11 20:19:16 +0000
committerChris Lattner <sabre@nondot.org>2002-02-11 20:19:16 +0000
commit7a79cfa2afb3a44ffdfe7364ca0f3eb2dbeaea3a (patch)
treef4aa75b4a5525b468ea473f74f47133bc8cf68c0 /llvm/lib
parent055944328098556157a6d86e36b311cf5d58ebf7 (diff)
downloadbcm5719-llvm-7a79cfa2afb3a44ffdfe7364ca0f3eb2dbeaea3a.tar.gz
bcm5719-llvm-7a79cfa2afb3a44ffdfe7364ca0f3eb2dbeaea3a.zip
Make array bound checks optional and disabled by default.
llvm-svn: 1725
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index d92764e49a6..d3aa4ccbf62 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -26,7 +26,7 @@ using std::cerr;
cl::Flag QuietMode ("quiet" , "Do not emit any non-program output");
cl::Alias QuietModeA("q" , "Alias for -quiet", cl::NoFlags, QuietMode);
-
+cl::Flag ArrayChecksEnabled("array-checks", "Enable array bound checks");
// Create a TargetData structure to handle memory addressing and size/alignment
// computations
@@ -797,7 +797,7 @@ static PointerTy getElementOffset(MemAccessInst *I, ExecutionContext &SF) {
assert(I->getOperand(ArgOff)->getType() == Type::UIntTy);
unsigned Idx = getOperandValue(I->getOperand(ArgOff++), SF).UIntVal;
if (const ArrayType *AT = dyn_cast<ArrayType>(ST))
- if (Idx >= AT->getNumElements()) {
+ if (Idx >= AT->getNumElements() && ArrayChecksEnabled) {
cerr << "Out of range memory access to element #" << Idx
<< " of a " << AT->getNumElements() << " element array."
<< " Subscript #" << (ArgOff-I->getFirstIndexOperandNumber())
OpenPOWER on IntegriCloud