- add XFAIL/UNSUPPORTED annotations for tests run wtih real MSVC - macroify usages of clang-specific attributes in asan tests - Add substitution for /Oy-/-fno-omit-frame-pointer This makes the dll_intercept_memset test work with mingw These are most of the changes that are required to get things running with MSVC, however there are some remaining build-flag tweaks. Nothing in here should be a functional change.
56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
// RUN: %clangxx_asan %s -o %t && %run %t
|
|
// RUN: %clangxx_asan %s -o %t -static-libstdc++ && %run %t
|
|
|
|
// Investigate why it fails with NDK 21.
|
|
// UNSUPPORTED: android, MSVC
|
|
|
|
#include "defines.h"
|
|
#include <stdio.h>
|
|
static volatile int zero = 0;
|
|
inline void pretend_to_do_something(void *x) {
|
|
__asm__ __volatile__("" : : "r" (x) : "memory");
|
|
}
|
|
|
|
__attribute__((noinline))
|
|
void ReallyThrow() {
|
|
fprintf(stderr, "ReallyThrow\n");
|
|
try {
|
|
if (zero == 0)
|
|
throw 42;
|
|
else if (zero == 1)
|
|
throw 1.;
|
|
} catch(double x) {
|
|
}
|
|
}
|
|
|
|
__attribute__((noinline))
|
|
void Throw() {
|
|
int a, b, c, d, e;
|
|
pretend_to_do_something(&a);
|
|
pretend_to_do_something(&b);
|
|
pretend_to_do_something(&c);
|
|
pretend_to_do_something(&d);
|
|
pretend_to_do_something(&e);
|
|
fprintf(stderr, "Throw stack = %p\n", &a);
|
|
ReallyThrow();
|
|
}
|
|
|
|
ATTRIBUTE_NOINLINE
|
|
void CheckStack() {
|
|
int ar[100];
|
|
pretend_to_do_something(ar);
|
|
for (int i = 0; i < 100; i++)
|
|
ar[i] = i;
|
|
fprintf(stderr, "CheckStack stack = %p, %p\n", ar, ar + 100);
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
try {
|
|
Throw();
|
|
} catch(int a) {
|
|
fprintf(stderr, "a = %d\n", a);
|
|
}
|
|
CheckStack();
|
|
}
|
|
|