Index: tests_lit/asan_tests/doublefree.ll |
diff --git a/tests_lit/asan_tests/doublefree.ll b/tests_lit/asan_tests/doublefree.ll |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca79ec41567d3111f72e9589ae61c37653881989 |
--- /dev/null |
+++ b/tests_lit/asan_tests/doublefree.ll |
@@ -0,0 +1,24 @@ |
+; Test that double frees are detected |
+ |
+; REQUIRES: no_minimal_build |
+ |
+; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
+; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \ |
+; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck --check-prefix=ERR %s |
+; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
+; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols -O2 \ |
+; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck --check-prefix=ERR %s |
+ |
+declare external i32 @malloc(i32) |
+declare external void @free(i32) |
+declare external void @exit(i32) |
+ |
+define void @_start(i32 %arg) { |
+ %alloc = call i32 @malloc(i32 42) |
+ call void @free(i32 %alloc) |
+ call void @free(i32 %alloc) |
+ call void @exit(i32 1) |
+ ret void |
+} |
+ |
+; ERR: Double free of object at |