<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I believe I fixed that in r230173. </div><div><br></div><div>Kuba<br><br>Sent from my iPhone</div><div><br>On Feb 22, 2015, at 9:51 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 22, 2015 at 3:12 AM, Kuba Brecka <span dir="ltr"><<a href="mailto:kuba.brecka@gmail.com" target="_blank">kuba.brecka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: kuba.brecka<br>
Date: Sun Feb 22 05:12:17 2015<br>
New Revision: 230172<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=230172&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=230172&view=rev</a><br>
Log:<br>
Fix <a href="http://gc-test.cc">gc-test.cc</a> to work under higher -O levels<br>
<br>
The <a href="http://gc-test.cc">gc-test.cc</a> tries underflows of a variable up to -32 bytes, but on i386, the left redzone is not 32 bytes, it’s only 16 bytes and therefore the access to var[-32] is completely off. The reason why this test didn’t fail before is that we’ve been lucky and there was another variable before the var array, which was also instrumented. This fix uses “-32” for 64-bit systems and “-16” for 32-bit.<br>
<br>
Reviewed at <a href="http://reviews.llvm.org/D7809" target="_blank">http://reviews.llvm.org/D7809</a><br>
<br>
<br>
Modified:<br>
    compiler-rt/trunk/test/asan/TestCases/<a href="http://gc-test.cc">gc-test.cc</a><br>
<br>
Modified: compiler-rt/trunk/test/asan/TestCases/<a href="http://gc-test.cc">gc-test.cc</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/gc-test.cc?rev=230172&r1=230171&r2=230172&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/gc-test.cc?rev=230172&r1=230171&r2=230172&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/test/asan/TestCases/<a href="http://gc-test.cc">gc-test.cc</a> (original)<br>
+++ compiler-rt/trunk/test/asan/TestCases/<a href="http://gc-test.cc">gc-test.cc</a> Sun Feb 22 05:12:17 2015<br>
@@ -1,6 +1,9 @@<br>
 // RUN: %clangxx_asan %s -pthread -o %t<br>
 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1<br>
 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0<br>
+// RUN: %clangxx_asan -O3 %s -pthread -o %t<br>
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1<br>
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0<br>
 // REQUIRES: stable-runtime<br>
<br>
 #include <assert.h><br>
@@ -9,6 +12,7 @@<br>
 #include <sanitizer/asan_interface.h><br>
<br>
 static const int kNumThreads = 2;<br>
+static const int kLeftRedzoneSize = sizeof(void *) * 4;<br></blockquote><div><br>non-ascii character here (after the '*' before the space)?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 void *Thread(void *unused)  {<br>
   void *fake_stack = __asan_get_current_fake_stack();<br>
@@ -23,7 +27,7 @@ void *Thread(void *unused)  {<br>
     assert(real_stack);<br>
     assert((char*)beg <= (char*)&var[0]);<br>
     assert((char*)end > (char*)&var[0]);<br>
-    for (int i = -32; i < 15; i++) {<br>
+    for (int i = -kLeftRedzoneSize; i < 15; i++) {<br>
       void *beg1, *end1;<br>
       char *ptr = &var[0] + i;<br>
       void *real_stack1 =<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>
</div></blockquote></body></html>