about summary refs log tree commit diff homepage
path: root/test/Feature/ReallocFailure.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Feature/ReallocFailure.c')
-rw-r--r--test/Feature/ReallocFailure.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Feature/ReallocFailure.c b/test/Feature/ReallocFailure.c
new file mode 100644
index 00000000..e5105c33
--- /dev/null
+++ b/test/Feature/ReallocFailure.c
@@ -0,0 +1,18 @@
+// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
+// RUN: %klee --exit-on-error %t1.bc
+
+#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 == 0);
+  assert(p[1] == 52);
+
+  return 0;
+}