summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/tests/unit
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-07-01 18:01:20 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-07-01 18:01:20 +0000
commit06ff6cbf4d5b8a34e35363bdde82aa50771312f1 (patch)
tree7810cfaaa7d55d8dcfdb3fd970d92515dad5fd21 /compiler-rt/lib/tsan/tests/unit
parent9b35cf52d2a88cda5167c9638696adce5b152720 (diff)
downloadbcm5719-llvm-06ff6cbf4d5b8a34e35363bdde82aa50771312f1.tar.gz
bcm5719-llvm-06ff6cbf4d5b8a34e35363bdde82aa50771312f1.zip
[TSan] Equalize the behavior of __tsan_get_allocated_size and user_alloc_usable_size.
The former used to crash with a null deref if it was given a not owned pointer, while the latter returned 0. Now they both return 0. This is still not the best possible behavior: it is better to print an error report with a stack trace, pointing to the error in user code, as we do in ASan. llvm-svn: 212112
Diffstat (limited to 'compiler-rt/lib/tsan/tests/unit')
-rw-r--r--compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc b/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
index d8afeaf4d9f..e52a85aacb4 100644
--- a/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
+++ b/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
@@ -51,8 +51,8 @@ TEST(Mman, User) {
char *p2 = (char*)user_alloc(thr, pc, 20);
EXPECT_NE(p2, (char*)0);
EXPECT_NE(p2, p);
- EXPECT_EQ(user_alloc_usable_size(thr, pc, p), (uptr)10);
- EXPECT_EQ(user_alloc_usable_size(thr, pc, p2), (uptr)20);
+ EXPECT_EQ(10U, user_alloc_usable_size(p));
+ EXPECT_EQ(20U, user_alloc_usable_size(p2));
user_free(thr, pc, p);
user_free(thr, pc, p2);
}
@@ -107,11 +107,12 @@ TEST(Mman, UsableSize) {
uptr pc = 0;
char *p = (char*)user_alloc(thr, pc, 10);
char *p2 = (char*)user_alloc(thr, pc, 20);
- EXPECT_EQ(0U, user_alloc_usable_size(thr, pc, NULL));
- EXPECT_EQ(10U, user_alloc_usable_size(thr, pc, p));
- EXPECT_EQ(20U, user_alloc_usable_size(thr, pc, p2));
+ EXPECT_EQ(0U, user_alloc_usable_size(NULL));
+ EXPECT_EQ(10U, user_alloc_usable_size(p));
+ EXPECT_EQ(20U, user_alloc_usable_size(p2));
user_free(thr, pc, p);
user_free(thr, pc, p2);
+ EXPECT_EQ(0U, user_alloc_usable_size((void*)0x123));
}
TEST(Mman, Stats) {
OpenPOWER on IntegriCloud