[compiler-rt] r204808 - tsan: fix another compiler-injected memset

Dmitry Vyukov dvyukov at google.com
Wed Mar 26 07:13:00 PDT 2014


Author: dvyukov
Date: Wed Mar 26 09:13:00 2014
New Revision: 204808

URL: http://llvm.org/viewvc/llvm-project?rev=204808&view=rev
Log:
tsan: fix another compiler-injected memset
newer gcc inserts memset here


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=204808&r1=204807&r2=204808&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Wed Mar 26 09:13:00 2014
@@ -150,7 +150,8 @@ static void MapRodata() {
   // Fill the file with kShadowRodata.
   const uptr kMarkerSize = 512 * 1024 / sizeof(u64);
   InternalScopedBuffer<u64> marker(kMarkerSize);
-  for (u64 *p = marker.data(); p < marker.data() + kMarkerSize; p++)
+  // volatile to prevent insertion of memset
+  for (volatile u64 *p = marker.data(); p < marker.data() + kMarkerSize; p++)
     *p = kShadowRodata;
   internal_write(fd, marker.data(), marker.size());
   // Map the file into memory.





More information about the llvm-commits mailing list