diff options
author | Mohit K. Bhakkad <mohit.bhakkad@gmail.com> | 2016-05-23 08:19:11 +0000 |
---|---|---|
committer | Mohit K. Bhakkad <mohit.bhakkad@gmail.com> | 2016-05-23 08:19:11 +0000 |
commit | 0fdb589b1daa4be6948d1b852e4a6e2ccb2a8696 (patch) | |
tree | 83af5c689ee71ccf17287420e181ad57239752b2 | |
parent | 969db4d3dc047df59e3e81f1f071665322a58e33 (diff) | |
download | compiler-rt-0fdb589b1daa4be6948d1b852e4a6e2ccb2a8696.tar.gz |
Merging r262302:
------------------------------------------------------------------------
r262302 | mohit.bhakkad | 2016-03-01 11:23:30 +0530 (Tue, 01 Mar 2016) | 7 lines
[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
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_38@270402 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/msan/param_tls_limit.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/test/msan/param_tls_limit.cc b/test/msan/param_tls_limit.cc index 1c504da42..d34376a1f 100644 --- a/test/msan/param_tls_limit.cc +++ b/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<int N> 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); } |