[ubsan] Fix vptr.cpp test to be more resilient. NFC.
authorRobert Lougher <rob.lougher@gmail.com>
Wed, 26 Oct 2016 16:02:36 +0000 (16:02 +0000)
committerRobert Lougher <rob.lougher@gmail.com>
Wed, 26 Oct 2016 16:02:36 +0000 (16:02 +0000)
The test contains a switch statement in which two of the cases are
tail-merged, with the call to __ubsan_handle_dynamic_type_cache_miss_abort
in the common tail. When tail-merging occurs, the debug location of the
tail is randomly taken from one of the merge inputs.  Luckily for the test,
the expected line number in the check is the one which is chosen by the
tail-merge.  However, if the switch cases are re-ordered the test will
fail.

This patch disables tail-merge, making the test resilient to changes
in tail-merge, and unblocking review D25742.  It does not change the
semantics of the test.

llvm-svn: 285208

compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp

index 62fb4ed..53a79c9 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
+// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false
 // RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT
 // RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU
 // RUN: %run %t rS && %run %t rV && %run %t oV