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>


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>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to