<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 21, 2013 at 11:11 AM, Peter Collingbourne <span dir="ltr"><<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: pcc<br>
Date: Mon Oct 21 13:11:57 2013<br>
New Revision: 193098<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=193098&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=193098&view=rev</a><br>
Log:<br>
Use internal_memset to initialize this variable.<br>
<br>
Otherwise, the compiler may use memset in non-optimized builds, which is<br>
forbidden in the nolibc part of the runtime.<br></blockquote><div><br>Are there no flags you can pass to the compiler to just ensure that doesn't happen?<br><br>Do we need a comment on this code to explain why it shouldn't be transformed into the prior form? And/or a build check to ensure that anything with memsets, etc, fails the build?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=193098&r1=193097&r2=193098&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=193098&r1=193097&r2=193098&view=diff</a><br>

==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Mon Oct 21 13:11:57 2013<br>
@@ -218,7 +218,8 @@ uptr GetTid() {<br>
 }<br>
<br>
 u64 NanoTime() {<br>
-  kernel_timeval tv = {};<br>
+  kernel_timeval tv;<br>
+  internal_memset(&tv, 0, sizeof(tv));<br>
   internal_syscall(__NR_gettimeofday, &tv, 0);<br>
   return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000;<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>