[ was: Re: [PATCH] gdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests ] On 11/4/21 9:04 PM, Simon Marchi wrote: > On 2021-11-03 06:24, Tom de Vries via Gdb-patches wrote: >> On 11/2/21 9:34 PM, Simon Marchi via Gdb-patches wrote: >>> We see some additional failures when running the testsuite against a GDB >>> compiled with ASan, compared to a GDB compiled without ASan. Some of >>> them are caused by the memory leak report shown by the GDB process when >>> it exits, and the fact that it makes it exit with a non-zero exit code. >>> >>> I generally try to remember to set ASAN_OPTIONS=detect_leaks=0 in my >>> environment when running the tests, but I don't always do it. I think >>> it would be nice if the testsuite did it. I don't see any use to have >>> leak detection when running the tests. That is, unless we ever have a >>> test that ensures GDB doesn't leak memory, which isn't going to happen >>> any time soon. >>> >> >> I like the idea. I also use the setting in my test scripts. >> >> FWIW, in addition, I also use "alloc_dealloc_mismatch=0", that error was >> triggered at some point. I've just done a run without this setting, and >> it didn't trigger anything. >> >> I tried to understand why, and stumbled onto >> https://sourceware.org/pipermail/gdb-patches/2021-May/178413.html , >> which seems to have been approved, but never committed. The problem >> described there, using LD_PRELOAD like so: >> ... >> $ LD_PRELOAD=/usr/lib64/libasan.so.6 ./gdb >> ... >> does reproduce for me, and applying the patch fixes it. I've done a >> build and test run, and will commit shortly. >> >> Also there a few test-cases which fail when using asan, we could >> annotate those perhaps with abort_on_error=1 or some such. > > Starting with this commit, I get these 4 errors with clang 12, in a > non-ASan build. The 2 -Wimplicit-exception-spec-mismatch can be fixed > by adding "noexcept", but I don't know about the -Wmissing-prototypes > ones. It might indicate that the prototype of the functions isn't > right, but I can't find the problem. > > Note that with Clang, I build with -std=gnu++17 in CXXFLAGS to avoid > the problem with gnulib headers in the string_view selftests. > Thanks for mentioning this, that saved me some time :) Reproduced, with clang 13. Fixed by patch below, WDYT? Thanks, - Tom