diff options
-rw-r--r-- | lib/Core/MemoryManager.cpp | 7 | ||||
-rw-r--r-- | test/Feature/Realloc.c (renamed from test/Feature/ReallocFailure.c) | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp index 06c234a2..a1198007 100644 --- a/lib/Core/MemoryManager.cpp +++ b/lib/Core/MemoryManager.cpp @@ -36,10 +36,9 @@ MemoryManager::~MemoryManager() { MemoryObject *MemoryManager::allocate(uint64_t size, bool isLocal, bool isGlobal, const llvm::Value *allocSite) { - if (size>10*1024*1024) { - klee_warning_once(0, "failing large alloc: %u bytes", (unsigned) size); - return 0; - } + if (size>10*1024*1024) + klee_warning_once(0, "Large alloc: %u bytes. KLEE may run out of memory.", (unsigned) size); + uint64_t address = (uint64_t) (unsigned long) malloc((unsigned) size); if (!address) return 0; diff --git a/test/Feature/ReallocFailure.c b/test/Feature/Realloc.c index e5105c33..a47adad6 100644 --- a/test/Feature/ReallocFailure.c +++ b/test/Feature/Realloc.c @@ -1,5 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee --exit-on-error %t1.bc +// RUN: grep "KLEE: WARNING ONCE: Large alloc" klee-last/warnings.txt #include <assert.h> #include <stdlib.h> @@ -11,8 +12,7 @@ int main() { p[1] = 52; int *p2 = realloc(p, 1<<30); - assert(p2 == 0); - assert(p[1] == 52); + assert(p2[1] == 52); return 0; } |