[compiler-rt] r261739 - [MSAN] Fix memcmp_test on MIPS
Sagar Thakur via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 05:48:15 PST 2016
Author: slthakur
Date: Wed Feb 24 07:48:14 2016
New Revision: 261739
URL: http://llvm.org/viewvc/llvm-project?rev=261739&view=rev
Log:
[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
Modified:
compiler-rt/trunk/test/msan/memcmp_test.cc
Modified: compiler-rt/trunk/test/msan/memcmp_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/memcmp_test.cc?rev=261739&r1=261738&r2=261739&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/memcmp_test.cc (original)
+++ compiler-rt/trunk/test/msan/memcmp_test.cc Wed Feb 24 07:48:14 2016
@@ -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
}
More information about the llvm-commits
mailing list