[compiler-rt] r253981 - [tsan] Fix stack_sync_reuse.cc test on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 05:29:15 PST 2015


Author: kuba.brecka
Date: Tue Nov 24 07:29:15 2015
New Revision: 253981

URL: http://llvm.org/viewvc/llvm-project?rev=253981&view=rev
Log:
[tsan] Fix stack_sync_reuse.cc test on OS X

The test relies on two variables in different frames to end up being on the same address. For some reason, this isn't true on OS X. This patch adds `__attribute__((aligned(64)))` to the variables, which actually makes the variables occupy the same address. This is still not a guarantee, but it's more likely to work (the test looks very fragile already).

Differential Revision: http://reviews.llvm.org/D14925


Modified:
    compiler-rt/trunk/test/tsan/stack_sync_reuse.cc

Modified: compiler-rt/trunk/test/tsan/stack_sync_reuse.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/stack_sync_reuse.cc?rev=253981&r1=253980&r2=253981&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/stack_sync_reuse.cc (original)
+++ compiler-rt/trunk/test/tsan/stack_sync_reuse.cc Tue Nov 24 07:29:15 2015
@@ -31,7 +31,8 @@ void *Thread(void *x) {
 }
 
 void __attribute__((noinline)) foobar() {
-  long s;
+  __attribute__((aligned(64))) long s;
+
   addr = &s;
   __atomic_store_n(&s, 0, __ATOMIC_RELAXED);
   __atomic_store_n(&syncp, &s, __ATOMIC_RELEASE);
@@ -40,7 +41,8 @@ void __attribute__((noinline)) foobar()
 }
 
 void __attribute__((noinline)) barfoo() {
-  long s;
+  __attribute__((aligned(64))) long s;
+
   if (addr != &s) {
     printf("address mismatch addr=%p &s=%p\n", addr, &s);
     exit(1);




More information about the llvm-commits mailing list