Skip to content

Commit

Permalink
Use address sanitizer to detect memory related errors
Browse files Browse the repository at this point in the history
  • Loading branch information
k4rtik committed Oct 9, 2016
1 parent 52606e5 commit 5846daa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linux.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CC = gcc
CFLAGS = -O0 -g -std=gnu11 -fPIC -march=native -Wall -Wextra -Wunused
CFLAGS += -Werror -Wshadow
CFLAGS += -Werror -Wshadow -fsanitize=address
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS = -shared --coverage
RM = rm -f
Expand Down

4 comments on commit 5846daa

@anmolsarma
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would make sense to have a debug or test target in the Makefile that is built with ASan?

@k4rtik
Copy link
Contributor Author

@k4rtik k4rtik commented on 5846daa Oct 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Currently, the whole Makefile is meant for debugging, perhaps we could include this suggestion in #35.

@anmolsarma
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding ASan seems to have broken the Python bindings:

ImportError: /home/anmol/Trunk/cpslib/libpslib.so: undefined symbol: __asan_option_detect_stack_use_after_return

@k4rtik
Copy link
Contributor Author

@k4rtik k4rtik commented on 5846daa Oct 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @unmole, I should have verified make test before adding this change. Will need to revert it as we are using Valgrind anyway.

Also, https://github.com/google/sanitizers/wiki/AddressSanitizer#faq suggests using ASAN is incompatible with the flags like -Wl that we use for our shared library.

Please sign in to comment.