[PATCH] D126781: [CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 09:54:58 PDT 2022


hctim added a comment.

Looks like this broke the ASan buildbot (and may have been missed because the bot was already red at the time):

https://lab.llvm.org/buildbot/#/builders/5/builds/24588

Instructions on how to repro the bot are here: https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild

  FAIL: Clang :: Interpreter/execute.cpp (9159 of 66378)
  ******************** TEST 'Clang :: Interpreter/execute.cpp' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);'             'auto r1 = printf("i = %d\n", i);' | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck --check-prefix=CHECK-DRIVER /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp
  : 'RUN: at line 6';   cat /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/clang-repl | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp
  --
  Exit Code: 2
  Command Output (stderr):
  --
  =================================================================
  ==58455==ERROR: LeakSanitizer: detected memory leaks
  Direct leak of 3912 byte(s) in 3 object(s) allocated from:
      #0 0x55f45fa2983d in operator new(unsigned long) /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
      #1 0x55f4600f75ad in llvm::RegisterTargetMachine<llvm::X86TargetMachine>::Allocator(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, llvm::Optional<llvm::Reloc::Model>, llvm::Optional<llvm::CodeModel::Model>, llvm::CodeGenOpt::Level, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/MC/TargetRegistry.h:1306:12
      #2 0x55f46267c8bb in createTargetMachine /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/MC/TargetRegistry.h:466:12
      #3 0x55f46267c8bb in CreateTargetMachine /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:560:23
      #4 0x55f46267c8bb in EmitAssembly /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1012:3
      #5 0x55f46267c8bb in clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1182:13
      #6 0x55f4626736e5 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:379:7
      #7 0x55f4615be6cc in clang::IncrementalParser::ParseOrWrapTopLevelDecl() /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:218:13
      #8 0x55f4615c0e13 in clang::IncrementalParser::Parse(llvm::StringRef) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:265:14
      #9 0x55f4615bb814 in clang::Interpreter::Parse(llvm::StringRef) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/Interpreter.cpp:207:22
      #10 0x55f45fa30581 in clang::Interpreter::ParseAndExecute(llvm::StringRef) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/include/clang/Interpreter/Interpreter.h:64:16
      #11 0x55f45fa2e95c in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/clang-repl/ClangRepl.cpp:97:30
      #12 0x7fde05cc509a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) (BuildId: eb6a5dd378d22b1e695984462a799cd4c81cdc22)
  
  Indirect leak of 32776 byte(s) in 1 object(s) allocated from:
      #0 0x55f45f9f8c88 in calloc /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:77:3
      #1 0x55f460cf72a2 in safe_calloc /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/Support/MemAlloc.h:40:18
      #2 0x55f460cf72a2 in AllocateBuckets /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/FoldingSet.cpp:173:40
      #3 0x55f460cf72a2 in llvm::FoldingSetBase::FoldingSetBase(unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/FoldingSet.cpp:187:13
      #4 0x55f46a156d6a in FoldingSetImpl /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FoldingSet.h:438:9
      #5 0x55f46a156d6a in ContextualFoldingSet /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/FoldingSet.h:620:9
      #6 0x55f46a156d6a in clang::ASTContext::ASTContext(clang::LangOptions&, clang::SourceManager&, clang::IdentifierTable&, clang::SelectorTable&, clang::Builtin::Context&, clang::TranslationUnitKind) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/AST/ASTContext.cpp:976:7
      #7 0x55f460f2c1eb in clang::CompilerInstance::createASTContext() /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:554:23
      #8 0x55f4612e7d71 in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:918:10
      #9 0x55f460f37655 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1032:13
      #10 0x55f4615bd1af in clang::IncrementalParser::IncrementalParser(std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance>>, llvm::LLVMContext&, llvm::Error&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:130:7
      #11 0x55f4615bb00c in make_unique<clang::IncrementalParser, std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance> >, llvm::LLVMContext &, llvm::Error &> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan/include/c++/v1/__memory/unique_ptr.h:717:32
      #12 0x55f4615bb00c in clang::Interpreter::Interpreter(std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance>>, llvm::Error&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/Interpreter.cpp:179:16
      #13 0x55f4615bb4a6 in clang::Interpreter::create(std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance>>) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/Interpreter.cpp:189:40
      #14 0x55f45fa2e1e8 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/clang-repl/ClangRepl.cpp:85:27
      #15 0x7fde05cc509a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) (BuildId: eb6a5dd378d22b1e695984462a799cd4c81cdc22)
  
  < ... snip, many more objects leaked ... >


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126781/new/

https://reviews.llvm.org/D126781



More information about the cfe-commits mailing list