diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-11 20:19:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-11 20:19:16 +0000 |
commit | c0fbd57c978ecefdcce3ee054cbe736f4f82a76c (patch) | |
tree | a558bc6f501f474951873dba38519b8f33ba19b9 /lib | |
parent | 0cac4b8f3fb4a86c8516b7b8395977837082184b (diff) | |
download | external_llvm-c0fbd57c978ecefdcce3ee054cbe736f4f82a76c.zip external_llvm-c0fbd57c978ecefdcce3ee054cbe736f4f82a76c.tar.gz external_llvm-c0fbd57c978ecefdcce3ee054cbe736f4f82a76c.tar.bz2 |
Make array bound checks optional and disabled by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Execution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index d92764e..d3aa4cc 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/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()) |