about summary refs log tree commit diff homepage
path: root/test/Feature/Realloc.c
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2012-11-28 18:08:52 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2012-11-28 18:08:52 +0000
commit993c4d6be0bcc826ccc1a735a09b875d8784ad7f (patch)
treecd28bdeed758dc4969d827efd952da6527594bbe /test/Feature/Realloc.c
parent6d9be03c5f322207637c88eac881563c1f8420ac (diff)
downloadklee-993c4d6be0bcc826ccc1a735a09b875d8784ad7f.tar.gz
Only emitting a warning, instead of failing on large mallocs.
Addresses the issue raised by Bowen Zhou at http://keeda.stanford.edu/pipermail/klee-dev/2012-November/000972.html.
Fixed test case that depended on the old behavior.



git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@168797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Feature/Realloc.c')
-rw-r--r--test/Feature/Realloc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c
new file mode 100644
index 00000000..a47adad6
--- /dev/null
+++ b/test/Feature/Realloc.c
@@ -0,0 +1,18 @@
+// 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>
+#include <stdio.h>
+
+int main() {
+  int *p = malloc(sizeof(int)*2);
+  assert(p);
+  p[1] = 52;
+
+  int *p2 = realloc(p, 1<<30);
+  assert(p2[1] == 52);
+
+  return 0;
+}