[PATCH] [compiler-rt] Fix a flaky heap-overflow-large.cc test

Kuba Brecka kuba.brecka at gmail.com
Sun Mar 22 02:59:32 PDT 2015

The regression test in test/asan/TestCases/heap-overflow-large.cc returns an exit code with this statement:

    return res ? res : 1;

with the intention of always returning a non-zero exit code, no matter what `res` is (it's a result of a pretty much random memory read).  However, when `res` is accidentally a multiple of 256, then (at least on Darwin) this will be treated as a zero exit code.  Let's change the test to only return one byte of `res` and not the whole `int`.



Index: test/asan/TestCases/heap-overflow-large.cc
--- test/asan/TestCases/heap-overflow-large.cc
+++ test/asan/TestCases/heap-overflow-large.cc
@@ -19,5 +19,5 @@
   // CHECK: main
   // CHECK-NOT: CHECK failed
   delete[] x;
-  return res ? res : 1;
+  return (char)res ? (char)res : 1;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8515.22418.patch
Type: text/x-patch
Size: 358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150322/b00fd495/attachment.bin>

More information about the llvm-commits mailing list