Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: tests_lit/asan_tests/realloc_shrink.ll

Issue 2148413003: Subzero: Instrumented realloc (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added realloc test, fixed realloc redzones Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/asan_tests/instrumentmalloc.ll ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/asan_tests/realloc_shrink.ll
diff --git a/tests_lit/asan_tests/realloc_shrink.ll b/tests_lit/asan_tests/realloc_shrink.ll
new file mode 100644
index 0000000000000000000000000000000000000000..599a6cf7dd62f8aca79bca024330801c1123efca
--- /dev/null
+++ b/tests_lit/asan_tests/realloc_shrink.ll
@@ -0,0 +1,26 @@
+; Test that shrinking an allocation updates the redzones
+
+; 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" \
Jim Stichnoth 2016/07/21 01:42:09 You don't really need the double-quotes here.
+; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s
+
+
+declare external i32 @malloc(i32)
+declare external i32 @realloc(i32, i32)
+declare external void @free(i32)
+
+define void @_start(i32 %arg) {
+ %ptr16 = call i32 @malloc(i32 16)
+ %off12a = add i32 %ptr16, 12
+ %offptra = inttoptr i32 %off12a to i32*
+ %resa = load i32, i32* %offptra, align 1
+ %ptr8 = call i32 @realloc(i32 %ptr16, i32 8)
+ %off12b = add i32 %ptr8, 12
+ %offptrb = inttoptr i32 %off12b to i8*
+ %resb = load i8, i8* %offptrb, align 1
+ ret void
+}
+
+; CHECK: Illegal access of 1 bytes at
Jim Stichnoth 2016/07/21 01:42:09 "1 bytes" :) (never mind...)
« no previous file with comments | « tests_lit/asan_tests/instrumentmalloc.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698