https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78028

            Bug ID: 78028
           Summary: ASAN doesn't find memory leak
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barto at cambridgesemantics dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

Checking address sanitizer leaks lead me to
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer and the
sample code therein.

I copied/pasted it and ran it on my Ubuntu 14.04 box.
The leak for FooBar was detected and reported.
So I added the suppression file and got no leak reported.
I then removed the allocation code in the FooBar function and still had no
report of a memory leak.

516_ g++ -fsanitize=address lsan-suppressed.cc
517_ ./a.out

=================================================================
==4471==ERROR: LeakSanitizer: detected memory leaks
<snip>
519_ ASAN_OPTIONS=detect_leaks=1
LSAN_OPTIONS=suppressions=suppressions=suppr.txt ./a.out
-----------------------------------------------------
Suppressions used:
  count      bytes template
      1          7 FooBar

But no error for Baz as noted on the webpage. Removing the allocation in FooBar
will then pass without the suppression file applied.

Reply via email to