diff --git a/compiler-rt/lib/asan/Makefile.old b/compiler-rt/lib/asan/Makefile.old index cf14acea26ea..addb7865424b 100644 --- a/compiler-rt/lib/asan/Makefile.old +++ b/compiler-rt/lib/asan/Makefile.old @@ -210,7 +210,7 @@ all: b64 b32 test: t64 t32 output_tests lint output_tests: b32 b64 - cd tests && ./test_output.sh $(CLANG_CXX) + cd tests && ./test_output.sh $(CLANG_CXX) $(CLANG_CC) t64: b64 $(BIN)/asan_test64 diff --git a/compiler-rt/lib/asan/tests/asan_exceptions_test.cc b/compiler-rt/lib/asan/tests/asan_exceptions_test.cc index b4d656bdd218..ecd406de7561 100644 --- a/compiler-rt/lib/asan/tests/asan_exceptions_test.cc +++ b/compiler-rt/lib/asan/tests/asan_exceptions_test.cc @@ -9,7 +9,7 @@ class Action { fprintf(stderr, "%s\n", msg.c_str()); } void Throw(const char& arg) const { - PrintString("PrintString called!"); // this line is important + PrintString("PrintString called!"); // this line is important throw arg; } }; @@ -19,7 +19,7 @@ int main() { fprintf(stderr, "&a before = %p\n", &a); try { a.Throw('c'); - } catch (const char&) { + } catch(const char&) { fprintf(stderr, "&a in catch = %p\n", &a); } fprintf(stderr, "&a final = %p\n", &a); diff --git a/compiler-rt/lib/asan/tests/test_output.sh b/compiler-rt/lib/asan/tests/test_output.sh index 0d83a0192636..dff48d2c286f 100755 --- a/compiler-rt/lib/asan/tests/test_output.sh +++ b/compiler-rt/lib/asan/tests/test_output.sh @@ -2,9 +2,16 @@ OS=`uname` CXX=$1 +CC=$2 CXXFLAGS="-mno-omit-leaf-frame-pointer" SYMBOLIZER=../scripts/asan_symbolize.py +C_TEST=use-after-free +$CC -g -faddress-sanitizer -O2 $C_TEST.c || exit 1 +echo "Sanity checking a test in pure C" +./a.out 2>&1 | grep "heap-use-after-free" > /dev/null || exit 1 +rm ./a.out + for t in *.tmpl; do for b in 32 64; do for O in 0 1 2 3; do @@ -29,4 +36,5 @@ for t in *.tmpl; do done done done + exit 0