[compiler-rt][asan] Add noinline to use-after-scope testcases

Some testcases are unexpectedly passing with NPM.
This is because the target functions are inlined in NPM.

I think we should add noinline attribute to keep these test points.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D79648
This commit is contained in:
Jinsong Ji 2020-05-27 03:39:59 +00:00
parent 4ab03e62fd
commit 5ee902bb5f
3 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@
struct IntHolder {
explicit IntHolder(int *val = 0) : val_(val) { }
~IntHolder() {
__attribute__((noinline)) ~IntHolder() {
printf("Value: %d\n", *val_); // BOOM
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
// CHECK: #0 0x{{.*}} in IntHolder::~IntHolder{{.*}}.cpp:[[@LINE-2]]

View File

@ -8,7 +8,7 @@ struct IntHolder {
const IntHolder *saved;
void save(const IntHolder &holder) {
__attribute__((noinline)) void save(const IntHolder &holder) {
saved = &holder;
}

View File

@ -3,7 +3,7 @@
struct IntHolder {
const IntHolder& Self() const {
__attribute__((noinline)) const IntHolder &Self() const {
return *this;
}
int val = 3;