From: Mohit K. Bhakkad Date: Tue, 1 Mar 2016 05:53:30 +0000 (+0000) Subject: [Compiler-rt][MSan] fix param_tls_limit test for platforms where big arguments are... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94aa4d7e832b819afe18c70a4ac3c6ae53b8c1af;p=platform%2Fupstream%2Fllvm.git [Compiler-rt][MSan] fix param_tls_limit test for platforms where big arguments are sliced in smaller ones Reviewers: eugenis Subscribers: dsanders, jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D17129 llvm-svn: 262302 --- diff --git a/compiler-rt/test/msan/param_tls_limit.cc b/compiler-rt/test/msan/param_tls_limit.cc index 1c504da..d34376a 100644 --- a/compiler-rt/test/msan/param_tls_limit.cc +++ b/compiler-rt/test/msan/param_tls_limit.cc @@ -20,6 +20,17 @@ // In case of no overflow, it is still poisoned. #define NO_OVERFLOW(x) assert(__msan_test_shadow(&x, sizeof(x)) == 0) +#if defined(__x86_64__) +// In x86_64, if argument is partially outside tls, it is considered completly +// unpoisoned +#define PARTIAL_OVERFLOW(x) OVERFLOW(x) +#else +// In other archs, bigger arguments are splitted in multiple IR arguments, so +// they are considered poisoned till tls limit. Checking last byte of such arg: +#define PARTIAL_OVERFLOW(x) assert(__msan_test_shadow((char *)(&(x) + 1) - 1, 1) == -1) +#endif + + template struct S { char x[N]; @@ -34,17 +45,17 @@ void f800(S<800> s) { } void f801(S<801> s) { - OVERFLOW(s); + PARTIAL_OVERFLOW(s); } void f1000(S<1000> s) { - OVERFLOW(s); + PARTIAL_OVERFLOW(s); } void f_many(int a, double b, S<800> s, int c, double d) { NO_OVERFLOW(a); NO_OVERFLOW(b); - OVERFLOW(s); + PARTIAL_OVERFLOW(s); OVERFLOW(c); OVERFLOW(d); } @@ -54,7 +65,7 @@ void f_many(int a, double b, S<800> s, int c, double d) { void f_many2(int a, S<800 - 8 - 2> s, int c, double d) { NO_OVERFLOW(a); NO_OVERFLOW(s); - OVERFLOW(c); + PARTIAL_OVERFLOW(c); OVERFLOW(d); }