<div><div dir="auto">Chandler fixed it ahead of me. Sorry for not monitoring this as I should.</div></div><div dir="auto"><br></div><div dir="auto">Thank you,</div><div dir="auto"> Filipe</div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, 16 Jul 2018 at 18:08, Filipe Cabecinhas <<a href="mailto:filcab@filcab.net">filcab@filcab.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Sorry. Fixing!</div></div><div dir="auto"><br></div><div dir="auto"> Filipe</div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, 16 Jul 2018 at 14:57, Benjamin Kramer <<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 16, 2018 at 3:46 PM Filipe Cabecinhas via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: filcab<br>
Date: Mon Jul 16 06:41:54 2018<br>
New Revision: 337170<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=337170&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=337170&view=rev</a><br>
Log:<br>
[cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for us.<br>
<br>
Reviewers: eugenis, pcc, kcc<br>
<br>
Subscribers: delcypher, #sanitizers, llvm-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D49252" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49252</a><br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/cfi/cfi.cc<br>
<br>
Modified: compiler-rt/trunk/lib/cfi/cfi.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cfi/cfi.cc?rev=337170&r1=337169&r2=337170&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cfi/cfi.cc?rev=337170&r1=337169&r2=337170&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/cfi/cfi.cc (original)<br>
+++ compiler-rt/trunk/lib/cfi/cfi.cc Mon Jul 16 06:41:54 2018<br>
@@ -132,7 +132,10 @@ void ShadowBuilder::Start() {<br>
 void ShadowBuilder::AddUnchecked(uptr begin, uptr end) {<br>
   uint16_t *shadow_begin = MemToShadow(begin, shadow_);<br>
   uint16_t *shadow_end = MemToShadow(end - 1, shadow_) + 1;<br>
-  memset(shadow_begin, kUncheckedShadow,<br>
+  // memset takes a byte, so our unchecked shadow value requires both bytes to<br>
+  // be the same. Make sure we're ok during compilation.<br>
+  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));<br></blockquote><div><br></div><div><div>llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: error: & has lower precedence than ==; == will be evaluated first [-Werror,-Wparentheses]</div><div>  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));</div><div>                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><div>llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: note: place parentheses around the '==' expression to silence this warning</div><div>  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));</div><div>                                 ^</div><div>                                   (                                       )</div><div>llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:34: note: place parentheses around the & expression to evaluate it first</div><div>  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));</div><div>                                 ^</div><div>                (                      )</div><div>llvm/projects/compiler-rt/lib/cfi/cfi.cc:137:76: error: static_assert with no message is a C++17 extension [-Werror,-Wc++17-extensions]</div><div>  static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff));</div><div>                                                                           ^</div><div>                                                                           , ""</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+  memset(shadow_begin, kUncheckedShadow & 0xff,<br>
          (shadow_end - shadow_begin) * sizeof(*shadow_begin));<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div>