[PATCH] D23878: [libc++abi] Fix test under ASAN and MSAN

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 08:48:28 PDT 2016


smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, rsmith.
smeenai added a subscriber: cfe-commits.

When we're running tests under ASAN or MSAN, they're compiled with -O1,
which enables tail call elimination. This causes backtrace_test to fail:
the compiler performs tail call elimination for call3_nothrow, but it
can't for call3_throw, leading to a mismatched frame count. Disable tail
call elimination (and inlining, just to be explicit) to avoid this.

Test Plan:
Configured locally with -DLLVM_USE_SANITIZER=Address and was able to
reproduce the test failure. The test passes with this change.

https://reviews.llvm.org/D23878

Files:
  test/backtrace_test.pass.cpp
  test/backtrace_test.sh.cpp

Index: test/backtrace_test.sh.cpp
===================================================================
--- test/backtrace_test.sh.cpp
+++ test/backtrace_test.sh.cpp
@@ -9,6 +9,11 @@
 
 // UNSUPPORTED: libcxxabi-no-exceptions
 
+// We're comparing frame counts, so suppress inlining and tail call elimination
+// to avoid mismatches caused by optimizations.
+// RUN: %build -fno-inline -fno-optimize-sibling-calls
+// RUN: %run
+
 #include <assert.h>
 #include <stddef.h>
 #include <unwind.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23878.69256.patch
Type: text/x-patch
Size: 491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160825/43fac261/attachment.bin>


More information about the cfe-commits mailing list