Jeff King <peff@xxxxxxxx> writes: > You can already build and test with ASan by doing: > > make CFLAGS=-fsanitize=address test > > but there are a few slight annoyances: > > 1. It's a little long to type. > > 2. It override your CFLAGS completely. You'd probably > still want -O2, for instance. > > 3. It's a good idea to also turn off "recovery", which > lets the program keep running after a problem is > detected (with the intention of finding as many bugs as > possible in a given run). Since Git's test suite should > generally run without triggering any problems, it's > better to abort immediately and fail the test when we > do find an issue. Unfortunately I do not think Comparing between versions in https://gcc.gnu.org/onlinedocs, it appears that -fsanitize-recover is not configurable for folks still with GCC 4.x series, and this patch is not very useful unless you disable the recovery for the purpose of running our tests as you said X-<. > With this patch, all of that happens automatically when you > run: > > make SANITIZE=address test > > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Makefile b/Makefile > index 9c9c42f8f..59f6bdcd7 100644 > --- a/Makefile > +++ b/Makefile > @@ -1012,6 +1012,10 @@ ifdef DEVELOPER > CFLAGS += $(DEVELOPER_CFLAGS) > endif > > +ifdef SANITIZE > +BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE) > +endif > + > ifndef sysconfdir > ifeq ($(prefix),/usr) > sysconfdir = /etc