forked from OSchip/llvm-project
[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:
parent
4ab03e62fd
commit
5ee902bb5f
|
@ -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]]
|
||||
|
|
|
@ -8,7 +8,7 @@ struct IntHolder {
|
|||
|
||||
const IntHolder *saved;
|
||||
|
||||
void save(const IntHolder &holder) {
|
||||
__attribute__((noinline)) void save(const IntHolder &holder) {
|
||||
saved = &holder;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
struct IntHolder {
|
||||
const IntHolder& Self() const {
|
||||
__attribute__((noinline)) const IntHolder &Self() const {
|
||||
return *this;
|
||||
}
|
||||
int val = 3;
|
||||
|
|
Loading…
Reference in New Issue