diff options
author | Sagar Thakur <sagar.thakur@imgtec.com> | 2016-02-24 13:48:14 +0000 |
---|---|---|
committer | Sagar Thakur <sagar.thakur@imgtec.com> | 2016-02-24 13:48:14 +0000 |
commit | 8af7c767e50e2005d1f4f83b21a6c435b7a8055e (patch) | |
tree | f9666dce79950e3b16616f72d0e1f6494616dc22 /test/msan/memcmp_test.cc | |
parent | 26c4cb10b5246c2dd15aaf00b22675f1535dc2d8 (diff) |
[MSAN] Fix memcmp_test on MIPS
Summary: As per the test the 4th element of both arrays are not initialized and hence will contain garbage values. Memcmp returns the difference between the garbage values of the 4th element which will be different on every run of the test. And since the return value of memcmp is returned from main, we are getting random exit code every time.
Reviewers: kcc, eugenis
Subscribers: mohit.bhakkad, jaydeep, llvm-commits
Differential: http://reviews.llvm.org/D17534
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/msan/memcmp_test.cc')
-rw-r--r-- | test/msan/memcmp_test.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/msan/memcmp_test.cc b/test/msan/memcmp_test.cc index 95228eb12..5ade58a60 100644 --- a/test/msan/memcmp_test.cc +++ b/test/msan/memcmp_test.cc @@ -3,13 +3,16 @@ // RUN: MSAN_OPTIONS=intercept_memcmp=0 %run %t #include <string.h> +#include <stdio.h> int main(int argc, char **argv) { char a1[4]; char a2[4]; for (int i = 0; i < argc * 3; i++) a2[i] = a1[i] = i; int res = memcmp(a1, a2, 4); - return res; + if (!res) + printf("equals"); + return 0; // CHECK: Uninitialized bytes in __interceptor_memcmp at offset 3 // CHECK: MemorySanitizer: use-of-uninitialized-value } |