<div dir="ltr">This isn't enough. As I mentioned in the review comment, you need to check that LTO is available.<div><br></div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 8, 2017 at 12:27 PM, Teresa Johnson via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tejohnson<br>
Date: Wed Nov  8 12:27:28 2017<br>
New Revision: 317723<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=317723&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=317723&view=rev</a><br>
Log:<br>
[ThinLTO] Ensure sanitizer passes are run<br>
<br>
Recommit new test as linux-only.<br>
<br>
Added:<br>
    compiler-rt/trunk/test/asan/<wbr>TestCases/Linux/contiguous_<wbr>container_crash_thinlto.cc<br>
<br>
Added: compiler-rt/trunk/test/asan/<wbr>TestCases/Linux/contiguous_<wbr>container_crash_thinlto.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/contiguous_container_crash_thinlto.cc?rev=317723&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/<wbr>test/asan/TestCases/Linux/<wbr>contiguous_container_crash_<wbr>thinlto.cc?rev=317723&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/test/asan/<wbr>TestCases/Linux/contiguous_<wbr>container_crash_thinlto.cc (added)<br>
+++ compiler-rt/trunk/test/asan/<wbr>TestCases/Linux/contiguous_<wbr>container_crash_thinlto.cc Wed Nov  8 12:27:28 2017<br>
@@ -0,0 +1,53 @@<br>
+// RUN: %clangxx_asan -flto=thin -O %s -o %t.thinlto<br>
+// RUN: not %run %t.thinlto crash 2>&1 | FileCheck --check-prefix=CHECK-CRASH %s<br>
+// RUN: not %run %t.thinlto bad-bounds 2>&1 | FileCheck --check-prefix=CHECK-BAD-<wbr>BOUNDS %s<br>
+// RUN: not %run %t.thinlto bad-alignment 2>&1 | FileCheck --check-prefix=CHECK-BAD-<wbr>ALIGNMENT %s<br>
+// RUN: %env_asan_opts=detect_<wbr>container_overflow=0 %run %t.thinlto crash<br>
+//<br>
+// Test crash due to __sanitizer_annotate_<wbr>contiguous_container.<br>
+<br>
+#include <assert.h><br>
+#include <string.h><br>
+<br>
+extern "C" {<br>
+void __sanitizer_annotate_<wbr>contiguous_container(const void *beg, const void *end,<br>
+                                               const void *old_mid,<br>
+                                               const void *new_mid);<br>
+}  // extern "C"<br>
+<br>
+static volatile int one = 1;<br>
+<br>
+int TestCrash() {<br>
+  long t[100];<br>
+  t[60] = 0;<br>
+  __sanitizer_annotate_<wbr>contiguous_container(&t[0], &t[0] + 100, &t[0] + 100,<br>
+                                            &t[0] + 50);<br>
+// CHECK-CRASH: AddressSanitizer: container-overflow<br>
+// CHECK-CRASH: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_<wbr>overflow=0<br>
+  return (int)t[60 * one];  // Touches the poisoned memory.<br>
+}<br>
+<br>
+void BadBounds() {<br>
+  long t[100];<br>
+// CHECK-BAD-BOUNDS: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_<wbr>contiguous_container<br>
+  __sanitizer_annotate_<wbr>contiguous_container(&t[0], &t[0] + 100, &t[0] + 101,<br>
+                                            &t[0] + 50);<br>
+}<br>
+<br>
+void BadAlignment() {<br>
+  int t[100];<br>
+// CHECK-BAD-ALIGNMENT: ERROR: AddressSanitizer: bad parameters to __sanitizer_annotate_<wbr>contiguous_container<br>
+// CHECK-BAD-ALIGNMENT: ERROR: beg is not aligned by 8<br>
+  __sanitizer_annotate_<wbr>contiguous_container(&t[1], &t[0] + 100, &t[1] + 10,<br>
+                                            &t[0] + 50);<br>
+}<br>
+<br>
+int main(int argc, char **argv) {<br>
+  assert(argc == 2);<br>
+  if (!strcmp(argv[1], "crash"))<br>
+    return TestCrash();<br>
+  else if (!strcmp(argv[1], "bad-bounds"))<br>
+    BadBounds();<br>
+  else if (!strcmp(argv[1], "bad-alignment"))<br>
+    BadAlignment();<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">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/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>