forked from OSchip/llvm-project
[asan]: test a pure C file with -faddress-sanitizer; lint fixes
llvm-svn: 145848
This commit is contained in:
parent
fdf9e1587a
commit
ab7940f6e1
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue