[libcxxabi] r279935 - test: fix test under ASAN and MSAN
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 28 11:16:00 PDT 2016
Author: compnerd
Date: Sun Aug 28 13:16:00 2016
New Revision: 279935
URL: http://llvm.org/viewvc/llvm-project?rev=279935&view=rev
Log:
test: fix test under ASAN and MSAN
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.
Patch by Shoaib Meenai!
Modified:
libcxxabi/trunk/test/backtrace_test.pass.cpp
Modified: libcxxabi/trunk/test/backtrace_test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/backtrace_test.pass.cpp?rev=279935&r1=279934&r2=279935&view=diff
==============================================================================
--- libcxxabi/trunk/test/backtrace_test.pass.cpp (original)
+++ libcxxabi/trunk/test/backtrace_test.pass.cpp Sun Aug 28 13:16:00 2016
@@ -21,6 +21,7 @@ trace_function(struct _Unwind_Context* c
return _URC_NO_REASON;
}
+__attribute__ ((__noinline__))
void call3_throw(size_t* ntraced) {
try {
_Unwind_Backtrace(trace_function, ntraced);
@@ -29,10 +30,12 @@ void call3_throw(size_t* ntraced) {
}
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call3_nothrow(size_t* ntraced) {
_Unwind_Backtrace(trace_function, ntraced);
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call2(size_t* ntraced, bool do_throw) {
if (do_throw) {
call3_throw(ntraced);
@@ -41,6 +44,7 @@ void call2(size_t* ntraced, bool do_thro
}
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call1(size_t* ntraced, bool do_throw) {
call2(ntraced, do_throw);
}
More information about the cfe-commits
mailing list