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

            Bug ID: 94322
           Summary: Detected memory leaks while using clang
                    AddressSanitizer to build GCC
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, I use clang with AddressSanitizer and detected memory leaks while building
GCC.

The SUMMARY are:

=================================================================
==7174==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x4debb0 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x4debb0)
    #1 0x521a45 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x521a45)
    #2 0x51e2a9 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51e2a9)
    #3 0x51a8e5 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51a8e5)
    #4 0x7f20623dc82f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Direct leak of 23 byte(s) in 1 object(s) allocated from:
    #0 0x4de998 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x4de998)
    #1 0x5219c1 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x5219c1)
    #2 0x521b7d 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x521b7d)
    #3 0x51bb89 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51bb89)
    #4 0x7f20623dc82f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 13368 byte(s) in 456 object(s) allocated from:
    #0 0x4de998 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x4de998)
    #1 0x5219c1 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x5219c1)
    #2 0x521b7d 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x521b7d)
    #3 0x51a9f0 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51a9f0)
    #4 0x7f20623dc82f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 8168 byte(s) in 1 object(s) allocated from:
    #0 0x4debb0 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x4debb0)
    #1 0x521a45 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x521a45)
    #2 0x520384 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x520384)
    #3 0x51f5af 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51f5af)
    #4 0x51ab44 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51ab44)
    #5 0x7f20623dc82f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

Indirect leak of 7296 byte(s) in 456 object(s) allocated from:
    #0 0x4de998 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x4de998)
    #1 0x5219c1 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x5219c1)
    #2 0x51a9e5 
(/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc/build/genhooks+0x51a9e5)
    #3 0x7f20623dc82f  (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: 28967 byte(s) leaked in 915 allocation(s).
Makefile:2504: recipe for target 's-tm-texi' failed
make[3]: *** [s-tm-texi] Error 1
make[3]: *** Waiting for unfinished jobs....
31 warnings generated.
19 warnings generated.
rm fsf-funding.pod gcov.pod gpl.pod cpp.pod gcc.pod
make[3]: Leaving directory
'/home/haoxin/corpus-compilers/clang-build-gcc8/build/gcc'
Makefile:4617: recipe for target 'all-stage1-gcc' failed
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory
'/home/haoxin/corpus-compilers/clang-build-gcc8/build'
Makefile:24352: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory
'/home/haoxin/corpus-compilers/clang-build-gcc8/build'
Makefile:944: recipe for target 'all' failed


Here are my instructions:

$export FUZZ_FLAGS="-O2 -fno-omit-frame-pointer -g -fsanitize=address
-fsanitize-coverage=edge,trace-pc-guard,indirect-calls,trace-cmp,trace-div,trace-gep"

$CC="clang $FUZZ_FLAGS" CXX="clang++ $FUZZ_FLAGS" ../configure

$make -j4


Without FUZZ_FLAGS, clang can build GCC well.

I used GCC-8.1.0, clang-6.0, and Ubuntu16.04.

Reply via email to