<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - check-clang fails when trunk is built with LLVM_USE_SANITIZER=Address"
   href="https://bugs.llvm.org/show_bug.cgi?id=47678">47678</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>check-clang fails when trunk is built with LLVM_USE_SANITIZER=Address
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bryanpkc@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After cloning trunk on Ubuntu 20.04 (x86_64), and building with GCC 9.3.0, with
AddressSanitizer enabled, "ninja check-clang" results in a huge number of
failures:

Failed Tests (342):
  Clang :: AST/ast-print-record-decl.c
  Clang :: AST/attr-print-emit.cpp
  Clang :: Analysis/analyzer-enabled-checkers.c
  Clang :: Analysis/builtin_signbit.cpp
  Clang :: Analysis/global-region-invalidation.c
  Clang :: Analysis/invalid-a-na-ly-zer-con-fig-value.c
  Clang :: Analysis/invalid-analyzer-config-value.c
  .
  .
  Clang :: SemaCXX/constexpr-depth.cpp
  Clang :: SemaCXX/constexpr-steps.cpp
  Clang :: SemaCXX/operator-arrow-depth.cpp
  Clang :: SemaCXX/warn-unused-local-typedef-serialize.cpp
  Clang :: SemaObjC/class-stub-attr-unsupported.m
  Clang :: SemaObjC/class-stub-attr.m
  Clang :: SemaObjC/opaque-is-access-warn.m
  Clang :: SemaObjC/opaque-is-access.m
  Clang :: SemaObjC/warn-unreachable.m
  Clang :: SemaTemplate/instantiation-depth.cpp
  Clang :: Tooling/pch.cpp

********************
Unexpectedly Passed Tests (2):
  Clang :: Driver/XRay/xray-instrument-cpu.c
  Clang :: Driver/XRay/xray-instrument-os.c


Testing Time: 2967.10s
  Unsupported        :   708
  Passed             : 25634
  Expectedly Failed  :    22
  Failed             :   342
  Unexpectedly Passed:     2

The ASan failures can be reproduced by simply compiling helloworld.c with the
newly built clang:

$ echo 'int main() { return 0; }' | ./bin/clang -x c -c -o /dev/null -

=================================================================
==2758511==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 192 byte(s) in 1 object(s) allocated from:
    #0 0x7fc4e9840947 in operator new(unsigned long)
(/lib/x86_64-linux-gnu/libasan.so.5+0x10f947)
    #1 0x5558175af399 in std::_MakeUniq<clang::EmitObjAction>::__single_object
std::make_unique<clang::EmitObjAction>()
/usr/include/c++/9/bits/unique_ptr.h:857
    #2 0x5558175af399 in CreateFrontendBaseAction
/home/bryanpkc/src/llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:59
    #3 0x5558175af399 in clang::CreateFrontendAction(clang::CompilerInstance&)
/home/bryanpkc/src/llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:139
    #4 0x5558175b411f in
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/bryanpkc/src/llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:275
    #5 0x55580fb41e65 in cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/bryanpkc/src/llvm/llvm-project/clang/tools/driver/cc1_main.cpp:240
    #6 0x55580fb3201d in ExecuteCC1Tool
/home/bryanpkc/src/llvm/llvm-project/clang/tools/driver/driver.cpp:330
    #7 0x5558169d0657 in operator()
/home/bryanpkc/src/llvm/llvm-project/clang/lib/Driver/Job.cpp:400
    #8 0x5558169d0657 in
callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::string*, bool*) const::<lambda()> ></span >
/home/bryanpkc/src/llvm/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185
    #9 0x5558147c1cf1 in llvm::function_ref<void ()>::operator()() const
/home/bryanpkc/src/llvm/llvm-project/llvm/include/llvm/ADT/STLExtras.h:203
    #10 0x5558147c1cf1 in
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
/home/bryanpkc/src/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:424
    #11 0x5558169d8a1f in
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const
/home/bryanpkc/src/llvm/llvm-project/clang/lib/Driver/Job.cpp:400
    #12 0x555816904448 in
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
/home/bryanpkc/src/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:195
    #13 0x555816907995 in
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
/home/bryanpkc/src/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:246
    #14 0x55581694da96 in
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
/home/bryanpkc/src/llvm/llvm-project/clang/lib/Driver/Driver.cpp:1510
    #15 0x55580f89d6c4 in main
/home/bryanpkc/src/llvm/llvm-project/clang/tools/driver/driver.cpp:502
    #16 0x7fc4e91f00b2 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

Indirect leak of 196620 byte(s) in 1 object(s) allocated from:
    #0 0x7fc4e983edc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x55581484e99d in llvm::safe_calloc(unsigned long, unsigned long)
/home/bryanpkc/src/llvm/llvm-project/llvm/include/llvm/Support/MemAlloc.h:40
    #2 0x55581484e99d in llvm::StringMapImpl::init(unsigned int)
/home/bryanpkc/src/llvm/llvm-project/llvm/lib/Support/StringMap.cpp:58
    #3 0x55582272efaf in llvm::StringMap<clang::IdentifierInfo*,
llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>
<span class="quote">>::StringMap(unsigned int)</span >
/home/bryanpkc/src/llvm/llvm-project/llvm/include/llvm/ADT/StringMap.h:115
    .
    .



"ninja check-llvm" reports no failures.

The build was configured fairly simply:

cmake -G Ninja \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=$PWD/../install \
  -DCMAKE_C_FLAGS="-U_FORTIFY_SOURCE" \
  -DCMAKE_CXX_FLAGS="-UFORTIFY_SOURCE" \
  -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \
  -DLLVM_TARGETS_TO_BUILD="X86" \
  -DLLVM_USE_SANITIZER=Address \
  ../llvm</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>