11REPORT=report_sanitizer.txt
22OPTS=" -Wall -Werror -Wno-pointer-to-int-cast"
3+ LIB=" ../mapcodelib/mapcoder.o"
34
45export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true:strict_init_order=true
56
@@ -12,39 +13,39 @@ echo "Run with: -O0" | tee -a $REPORT
1213cd ../mapcodelib
1314gcc $OPTS -O0 -DDEBUG -c mapcoder.c
1415cd ../unittest
15- gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -fsanitize=address -o unittest
16+ gcc $OPTS -O0 -DDEBUG unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
1617./unittest | tee -a $REPORT
17- echo " ----------------" | tee -a $REPORT sanitize.txt
18+ echo " ----------------" | tee -a $REPORT
1819
1920# Optimize 1
2021echo " " | tee -a $REPORT
21- echo " Run with: -O1" | tee -a $REPORT sanitize.txt
22+ echo " Run with: -O1" | tee -a $REPORT
2223cd ../mapcodelib
2324gcc $OPTS -O1 -c mapcoder.c
2425cd ../unittest
25- gcc $OPTS -O1 unittest.c -lm -lpthread -fsanitize=address -o unittest
26+ gcc $OPTS -O1 unittest.c -lm -lpthread -fsanitize=address -o unittest $LINK
2627./unittest | tee -a $REPORT
27- echo " ----------------" | tee -a $REPORT sanitize.txt
28+ echo " ----------------" | tee -a $REPORT
2829
2930# Optimize 2
3031echo " " | tee -a $REPORT
31- echo " Run with: -O2" | tee -a $REPORT sanitize.txt
32+ echo " Run with: -O2" | tee -a $REPORT
3233cd ../mapcodelib
3334gcc $OPTS -O2 -c mapcoder.c
3435cd ../unittest
35- gcc $OPTS -O2 unittest.c -lm -lpthread -fsanitize=address -o unittest
36+ gcc $OPTS -O2 unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
3637./unittest | tee -a $REPORT
37- echo " ----------------" | tee -a $REPORT sanitize.txt
38+ echo " ----------------" | tee -a $REPORT
3839
3940# Optimize 3
4041echo " " | tee -a $REPORT
41- echo " Run with: -O3" | tee -a $REPORT sanitize.txt
42+ echo " Run with: -O3" | tee -a $REPORT
4243cd ../mapcodelib
4344gcc $OPTS -O3 -c mapcoder.c
4445cd ../unittest
45- gcc $OPTS -O3 unittest.c -lm -lpthread -fsanitize=address -o unittest
46+ gcc $OPTS -O3 unittest.c -lm -lpthread -fsanitize=address -o unittest $LIB
4647./unittest | tee -a $REPORT
47- echo " ----------------" | tee -a $REPORT sanitize.txt
48+ echo " ----------------" | tee -a $REPORT
4849
4950echo " " | tee -a $REPORT
5051echo " Report in: $REPORT "
0 commit comments