Here are the test results of a gnulib testdir configured with CFLAGS="-O -ggdb -fsanitize=address".
Most of the memory leaks of -fsanitize=leak are reported here as well. Additionally there are the following failures (see below). Notable ones are: 1) $ ./test-readtokens $ echo $? 1 $ strace ./test-readtokens ... ioctl(2, TCGETS, 0x7ffd80fbb890) = -1 EBADF (Bad file descriptor) write(2, "\n==============================="..., 67) = -1 EBADF (Bad file descriptor) write(2, "RawWrite can't output requested "..., 40) = -1 EBADF (Bad file descriptor) exit_group(1) = ? It looks like the problem comes from the 'closeout' module: When main() is finished, it closes fd 1 and 2, and the libasan then cannot perform the output it wants to do. 2) test-u8-casecoll It fails because HAVE_ICONV is not defined - because the test program in m4/iconv.m4 fails due to an iconv_t leak / memory leak. What is the best practice here? Should -fsanitize=address only be activated after configure has run? Or should all configure run tests be changed so that they free all allocated memory? Bruno FAIL: test-gc-arctwo ==================== ================================================================= ==31231==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1824 byte(s) in 1 object(s) allocated from: #0 0x7f2060d4879a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a) #1 0x42c247 in rpl_calloc ../../gllib/calloc.c:65 SUMMARY: AddressSanitizer: 1824 byte(s) leaked in 1 allocation(s). FAIL test-gc-arctwo (exit status: 23) FAIL: test-fprintf-posix2.sh ============================ ==781==ERROR: AddressSanitizer failed to allocate 0x4c7000 (5009408) bytes of LargeMmapAllocator (errno: 12) ERROR: Failed to mmap FAIL test-fprintf-posix2.sh (exit status: 1) FAIL: test-getgroups ==================== ================================================================= ==1746==ERROR: AddressSanitizer: negative-size-param: (size=-4) #0 0x7f0d68a7df25 (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x49f25) #1 0x402179 in getgroups /usr/include/x86_64-linux-gnu/bits/unistd.h:275 #2 0x402179 in rpl_getgroups ../../gllib/getgroups.c:85 #3 0x401784 in main ../../gltests/test-getgroups.c:58 #4 0x7f0d6838282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #5 0x4013f8 in _start (/media/develdata/devel/GNULIB/testdir-all/build-sana/gltests/test-getgroups+0x4013f8) 0x60400000dfd0 is located 0 bytes inside of 44-byte region [0x60400000dfd0,0x60400000dffc) allocated by thread T0 here: #0 0x7f0d68acc602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x401690 in main ../../gltests/test-getgroups.c:48 SUMMARY: AddressSanitizer: negative-size-param ??:0 ?? ==1746==ABORTING FAIL test-getgroups (exit status: 1) FAIL: test-printf-posix2.sh =========================== ==11485==ERROR: AddressSanitizer failed to allocate 0x4c7000 (5009408) bytes of LargeMmapAllocator (errno: 12) ERROR: Failed to mmap FAIL test-printf-posix2.sh (exit status: 1) FAIL: test-readtokens.sh ======================== FAIL test-readtokens.sh (exit status: 1) FAIL: test-u16-casecoll ======================= ../../gltests/unicase/test-casecmp.h:34: assertion 'my_casecmp (input, SIZEOF (input), NULL, 0, NULL, nf, &cmp) == 0' failed FAIL test-u16-casecoll (exit status: 134) FAIL: test-u32-casecoll ======================= ../../gltests/unicase/test-casecmp.h:34: assertion 'my_casecmp (input, SIZEOF (input), NULL, 0, NULL, nf, &cmp) == 0' failed FAIL test-u32-casecoll (exit status: 134) FAIL: test-u8-casecoll ====================== ../../gltests/unicase/test-casecmp.h:34: assertion 'my_casecmp (input, SIZEOF (input), NULL, 0, NULL, nf, &cmp) == 0' failed FAIL test-u8-casecoll (exit status: 134) FAIL: test-u16-normcoll ======================= ../../gltests/uninorm/test-u16-normcmp.h:34: assertion 'my_normcmp (input, SIZEOF (input), NULL, 0, nf, &cmp) == 0' failed FAIL test-u16-normcoll (exit status: 134) FAIL: test-u32-normcoll ======================= ../../gltests/uninorm/test-u32-normcmp.h:34: assertion 'my_normcmp (input, SIZEOF (input), NULL, 0, nf, &cmp) == 0' failed FAIL test-u32-normcoll (exit status: 134) FAIL: test-u8-normcoll ====================== ../../gltests/uninorm/test-u8-normcmp.h:34: assertion 'my_normcmp (input, SIZEOF (input), NULL, 0, nf, &cmp) == 0' failed FAIL test-u8-normcoll (exit status: 134) FAIL: test-u16-vasnprintf1 ========================== ../../gltests/unistdio/test-u16-printf1.h:196: assertion 'result != NULL' failed FAIL test-u16-vasnprintf1 (exit status: 134) FAIL: test-u16-vasprintf1 ========================= ../../gltests/unistdio/test-u16-printf1.h:196: assertion 'result != NULL' failed FAIL test-u16-vasprintf1 (exit status: 134) FAIL: test-u16-vsnprintf1 ========================= ../../gltests/unistdio/test-u16-printf1.h:196: assertion 'result != NULL' failed FAIL test-u16-vsnprintf1 (exit status: 134) FAIL: test-u16-vsprintf1 ======================== ../../gltests/unistdio/test-u16-printf1.h:196: assertion 'result != NULL' failed FAIL test-u16-vsprintf1 (exit status: 134) FAIL: test-u32-vasnprintf1 ========================== ../../gltests/unistdio/test-u32-printf1.h:196: assertion 'result != NULL' failed FAIL test-u32-vasnprintf1 (exit status: 134) FAIL: test-u32-vasprintf1 ========================= ../../gltests/unistdio/test-u32-printf1.h:196: assertion 'result != NULL' failed FAIL test-u32-vasprintf1 (exit status: 134) FAIL: test-u32-vsnprintf1 ========================= ../../gltests/unistdio/test-u32-printf1.h:196: assertion 'result != NULL' failed FAIL test-u32-vsnprintf1 (exit status: 134) FAIL: test-u32-vsprintf1 ======================== ../../gltests/unistdio/test-u32-printf1.h:196: assertion 'result != NULL' failed FAIL test-u32-vsprintf1 (exit status: 134) FAIL: test-u8-vasnprintf1 ========================= ../../gltests/unistdio/test-u8-printf1.h:176: assertion 'result != NULL' failed FAIL test-u8-vasnprintf1 (exit status: 134) FAIL: test-u8-vasprintf1 ======================== ../../gltests/unistdio/test-u8-printf1.h:176: assertion 'result != NULL' failed FAIL test-u8-vasprintf1 (exit status: 134) FAIL: test-u8-vsnprintf1 ======================== ../../gltests/unistdio/test-u8-printf1.h:176: assertion 'result != NULL' failed FAIL test-u8-vsnprintf1 (exit status: 134) FAIL: test-u8-vsprintf1 ======================= ../../gltests/unistdio/test-u8-printf1.h:176: assertion 'result != NULL' failed FAIL test-u8-vsprintf1 (exit status: 134) FAIL: test-ulc-vasnprintf1 ========================== ../../gltests/unistdio/test-ulc-printf1.h:63: assertion 'result != NULL' failed FAIL test-ulc-vasnprintf1 (exit status: 134) FAIL: test-ulc-vasprintf1 ========================= ../../gltests/unistdio/test-ulc-printf1.h:63: assertion 'result != NULL' failed FAIL test-ulc-vasprintf1 (exit status: 134) FAIL: test-ulc-vsnprintf1 ========================= ../../gltests/unistdio/test-ulc-printf1.h:63: assertion 'result != NULL' failed FAIL test-ulc-vsnprintf1 (exit status: 134) FAIL: test-ulc-vsprintf1 ======================== ../../gltests/unistdio/test-ulc-printf1.h:63: assertion 'result != NULL' failed FAIL test-ulc-vsprintf1 (exit status: 134)