[compiler-rt] r193098 - Use internal_memset to initialize this variable.

Peter Collingbourne peter at pcc.me.uk
Mon Oct 21 11:11:58 PDT 2013


Author: pcc
Date: Mon Oct 21 13:11:57 2013
New Revision: 193098

URL: http://llvm.org/viewvc/llvm-project?rev=193098&view=rev
Log:
Use internal_memset to initialize this variable.

Otherwise, the compiler may use memset in non-optimized builds, which is
forbidden in the nolibc part of the runtime.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=193098&r1=193097&r2=193098&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Mon Oct 21 13:11:57 2013
@@ -218,7 +218,8 @@ uptr GetTid() {
 }
 
 u64 NanoTime() {
-  kernel_timeval tv = {};
+  kernel_timeval tv;
+  internal_memset(&tv, 0, sizeof(tv));
   internal_syscall(__NR_gettimeofday, &tv, 0);
   return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;
 }





More information about the llvm-commits mailing list