Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang crashes for clang debug builds #102

Open
hygoni opened this issue Mar 20, 2024 · 4 comments
Open

Fix clang crashes for clang debug builds #102

hygoni opened this issue Mar 20, 2024 · 4 comments
Assignees

Comments

@hygoni
Copy link
Owner

hygoni commented Mar 20, 2024

The build script scripts/build.sh builds with -DCMAKE_BUILD_TYPE=Release.
But with build type Debug, the option -fsanitize=precise-leak fails to compile even a simple C program.

Let's fix them :P

Caution: Debug builds eats up a lot of memory (250GiB in my machine)

CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "/home/hyeyoo/precise-leak-sanitizer/build/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/hyeyoo/goinfre/wasm3/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_80bf8/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_80bf8.dir/build.make CMakeFiles/cmTC_80bf8.dir/build
    gmake[1]: Entering directory '/home/hyeyoo/goinfre/wasm3/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o
    /home/hyeyoo/precise-leak-sanitizer/build/bin/clang   -g -fsanitize=precise-leak -fno-omit-frame-pointer  -MD -MT CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o -c /home/hyeyoo/goinfre/wasm3/build/CMakeFiles/CMakeTmp/testCCompiler.c
    clang: /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Type.cpp:793: static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(EltTy) && "Invalid type for pointer element!"' failed.
    PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
    Stack dump:
    0.	Program arguments: /home/hyeyoo/precise-leak-sanitizer/build/bin/clang -g -fsanitize=precise-leak -fno-omit-frame-pointer -MD -MT CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o -c /home/hyeyoo/goinfre/wasm3/build/CMakeFiles/CMakeTmp/testCCompiler.c
    1.	<eof> parser at end of file
    2.	Optimizer
     #0 0x00000000044954cc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:602:22
     #1 0x00000000044958d2 PrintStackTraceSignalHandler(void*) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:675:1
     #2 0x000000000449330c llvm::sys::RunSignalHandlers() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Signals.cpp:104:20
     #3 0x0000000004494dfd llvm::sys::CleanupOnSignal(unsigned long) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:367:31
     #4 0x00000000043cdfa0 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
     #5 0x00000000043ce42f CrashRecoverySignalHandler(int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/CrashRecoveryContext.cpp:391:1
     #6 0x00007f164bc54df0 __restore_rt (/lib64/libc.so.6+0x54df0)
     #7 0x00007f164bca154c __pthread_kill_implementation (/lib64/libc.so.6+0xa154c)
     #8 0x00007f164bc54d46 gsignal (/lib64/libc.so.6+0x54d46)
     #9 0x00007f164bc287f3 abort (/lib64/libc.so.6+0x287f3)
    #10 0x00007f164bc2871b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
    #11 0x00007f164bc4dce6 (/lib64/libc.so.6+0x4dce6)
    #12 0x0000000003cb4336 llvm::PointerType::get(llvm::Type*, unsigned int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Type.cpp:796:13
    #13 0x0000000000dcf40c llvm::PointerType::getUnqual(llvm::Type*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/DerivedTypes.h:661:3
    #14 0x00000000062e8f66 PreciseLeakSanitizer::initializeModule() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:268:13
    #15 0x00000000062e99ab PreciseLeakSanitizer::run() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:330:39
    #16 0x00000000062e9d95 PreciseLeakSanitizerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:366:78
    #17 0x00000000047f30c4 llvm::detail::PassModel<llvm::Module, PreciseLeakSanitizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManagerInternal.h:90:3
    #18 0x0000000003c86cbe llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManager.h:521:20
    #19 0x00000000047db02d (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1083:12
    #20 0x00000000047db585 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1141:21
    #21 0x00000000047dc571 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1303:25
    #22 0x0000000005d8de3a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:386:24
    #23 0x0000000007d82f38 clang::ParseAST(clang::Sema&, bool, bool) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Parse/ParseAST.cpp:183:14
    #24 0x000000000537d822 clang::ASTFrontendAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1173:11
    #25 0x0000000005d8a67f clang::CodeGenAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:1208:5
    #26 0x000000000537d13b clang::FrontendAction::Execute() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1063:38
    #27 0x00000000052b356e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/CompilerInstance.cpp:1053:42
    #28 0x000000000550f600 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/hyeyoo/precise-leak-sanitizer/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38
    #29 0x0000000000d09ae6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/cc1_main.cpp:249:40
    #30 0x0000000000cfadb2 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:366:20
    #31 0x0000000000cfaf9b clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)::operator()(llvm::SmallVectorImpl<char const*>&) const /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:507:5
    #32 0x0000000000cfc589 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/ADT/STLFunctionalExtras.h:47:3
    #33 0x0000000005135255 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:3
    #34 0x00000000051340e6 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()::operator()() const /home/hyeyoo/precise-leak-sanitizer/clang/lib/Driver/Job.cpp:440:32
    #35 0x0000000005134508 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:40
    #36 0x0000000003288f2c llvm::function_ref<void ()>::operator()() const /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:62
    #37 0x00000000043ce5f7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/CrashRecoveryContext.cpp:427:10
    #38 0x00000000051342d2 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /home/hyeyoo/precise-leak-sanitizer/clang/lib/Driver/Job.cpp:440:7
    #39 0x00000000050d7005 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/hyeyoo/precise-leak-sanitizer/clang/lib/Driver/Compilation.cpp:199:22
    #40 0x00000000050d7331 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/hyeyoo/precise-leak-sanitizer/clang/lib/Driver/Compilation.cpp:253:62
    #41 0x00000000050e93a8 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Driver/Driver.cpp:1906:28
    #42 0x0000000000cfc136 clang_main(int, char**, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:542:39
    #43 0x0000000000d2d09a main /home/hyeyoo/precise-leak-sanitizer/build/tools/clang/tools/driver/clang-driver.cpp:15:58
    #44 0x00007f164bc3feb0 __libc_start_call_main (/lib64/libc.so.6+0x3feb0)
    #45 0x00007f164bc3ff60 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3ff60)
    #46 0x0000000000cf9365 _start (/home/hyeyoo/precise-leak-sanitizer/build/bin/clang+0xcf9365)
    clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
    clang version 17.0.6 ([email protected]:hygoni/precise-leak-sanitizer.git 54a886ed9403c05d2f64e3cec3fe0dd9a9eee27d)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/hyeyoo/precise-leak-sanitizer/build/bin
    clang: note: diagnostic msg:
    ********************

    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    clang: note: diagnostic msg: /tmp/testCCompiler-6a1864.c
    clang: note: diagnostic msg: /tmp/testCCompiler-6a1864.sh
    clang: note: diagnostic msg:

    ********************
    gmake[1]: *** [CMakeFiles/cmTC_80bf8.dir/build.make:79: CMakeFiles/cmTC_80bf8.dir/testCCompiler.c.o] Error 1
    gmake[1]: Leaving directory '/home/hyeyoo/goinfre/wasm3/build/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:127: cmTC_80bf8/fast] Error 2
@hygoni
Copy link
Owner Author

hygoni commented Mar 20, 2024

It turns out that it's because LLVM does not have a void pointer type.
Instead of the void pointer type, i8* has been used.

There are also "opaque pointers" (1, 2, 3) in the very recent LLVM releases,
maybe we can either use opaque pointers or i8*?

@hygoni
Copy link
Owner Author

hygoni commented Mar 20, 2024

Another crash after fixing the first issue:

clang-17: /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Instructions.cpp:652: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/hyeyoo/precise-leak-sanitizer/build/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir vector-3- -disable-free -clear-ast-before-backend -main-file-name vector-3.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fcoverage-compilation-dir=/home/hyeyoo/precise-leak-sanitizer -resource-dir /home/hyeyoo/precise-leak-sanitizer/build/lib/clang/17 -internal-isystem /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12 -internal-isystem /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/x86_64-redhat-linux -internal-isystem /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/backward -internal-isystem /home/hyeyoo/precise-leak-sanitizer/build/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-everything -fdeprecated-macro -fdebug-compilation-dir=/home/hyeyoo/precise-leak-sanitizer -ferror-limit 19 -fsanitize=precise-leak -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/vector-3-a19e4f.o -x c++ testcases/c++/leak/vector-3.cpp
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x00000000044954cc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:602:22
 #1 0x00000000044958d2 PrintStackTraceSignalHandler(void*) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:675:1
 #2 0x000000000449330c llvm::sys::RunSignalHandlers() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Signals.cpp:104:20
 #3 0x0000000004494eef SignalHandler(int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f1abf854df0 __restore_rt (/lib64/libc.so.6+0x54df0)
 #5 0x00007f1abf8a154c __pthread_kill_implementation (/lib64/libc.so.6+0xa154c)
 #6 0x00007f1abf854d46 gsignal (/lib64/libc.so.6+0x54d46)
 #7 0x00007f1abf8287f3 abort (/lib64/libc.so.6+0x287f3)
 #8 0x00007f1abf82871b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
 #9 0x00007f1abf84dce6 (/lib64/libc.so.6+0x4dce6)
#10 0x0000000003bd3b3d llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Instructions.cpp:651:3
#11 0x0000000000df4292 llvm::CallInst::CallInst(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&, llvm::Instruction*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instructions.h:1720:7
#12 0x0000000000df4132 llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&, llvm::Instruction*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instructions.h:1532:64
#13 0x0000000000df4601 llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/IRBuilder.h:2339:36
#14 0x0000000000df46ee llvm::IRBuilderBase::CreateCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/IRBuilder.h:2361:22
#15 0x00000000062e9d03 PreciseLeakSanitizer::CreateCallWithMetaData(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:358:50
#16 0x00000000062e82f2 PreciseLeakSanVisitor::visitCallInst(llvm::CallInst&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:168:35
#17 0x00000000062eff42 llvm::InstVisitor<PreciseLeakSanVisitor, void>::delegateCallInst(llvm::CallInst&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/InstVisitor.h:305:3
#18 0x00000000062edb8d llvm::InstVisitor<PreciseLeakSanVisitor, void>::visitCall(llvm::CallInst&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instruction.def:209:1
#19 0x00000000062ebea0 llvm::InstVisitor<PreciseLeakSanVisitor, void>::visit(llvm::Instruction&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instruction.def:209:1
#20 0x00000000062e9b37 PreciseLeakSanitizer::run() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:344:22
#21 0x00000000062e9d9d PreciseLeakSanitizerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:366:78
#22 0x00000000047f30c4 llvm::detail::PassModel<llvm::Module, PreciseLeakSanitizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManagerInternal.h:90:3
#23 0x0000000003c86cbe llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManager.h:521:20
#24 0x00000000047db02d (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1083:12
#25 0x00000000047db585 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1141:21
#26 0x00000000047dc571 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1303:25
#27 0x0000000005d8de3a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:386:24
#28 0x0000000007d82f40 clang::ParseAST(clang::Sema&, bool, bool) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Parse/ParseAST.cpp:183:14
#29 0x000000000537d822 clang::ASTFrontendAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1173:11
#30 0x0000000005d8a67f clang::CodeGenAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:1208:5
#31 0x000000000537d13b clang::FrontendAction::Execute() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1063:38
#32 0x00000000052b356e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/CompilerInstance.cpp:1053:42
#33 0x000000000550f600 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/hyeyoo/precise-leak-sanitizer/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38
#34 0x0000000000d09ae6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/cc1_main.cpp:249:40
#35 0x0000000000cfadb2 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:366:20
#36 0x0000000000cfb2c4 clang_main(int, char**, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:407:26
#37 0x0000000000d2d09a main /home/hyeyoo/precise-leak-sanitizer/build/tools/clang/tools/driver/clang-driver.cpp:15:58
#38 0x00007f1abf83feb0 __libc_start_call_main (/lib64/libc.so.6+0x3feb0)
#39 0x00007f1abf83ff60 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3ff60)
#40 0x0000000000cf9365 _start (/home/hyeyoo/precise-leak-sanitizer/build/bin/clang-17+0xcf9365)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.6 ([email protected]:hygoni/precise-leak-sanitizer.git c3295e5041c266848286a2c6e6bfe77d9e2d2209)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/hyeyoo/precise-leak-sanitizer/build/bin
clang++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/vector-3-18a72a.cpp
clang++: note: diagnostic msg: /tmp/vector-3-18a72a.sh
clang++: note: diagnostic msg:

********************
Compilation Failed : testcases/c++/leak/vector-3.cpp

@hygoni
Copy link
Owner Author

hygoni commented Mar 20, 2024

Instruction does not dominate all uses!
  %3 = alloca i8, i64 4, align 16, !dbg !30
  %11 = call ptr @__plsan_free_local_variable(ptr %3, i64 4, ptr null, i1 true, i1 %10), !dbg !42, !plsan.instrument !15
Instruction does not dominate all uses!
  %5 = alloca i8, i64 8, align 16, !dbg !39
  %13 = call ptr @__plsan_free_local_variable(ptr %5, i64 8, ptr null, i1 true, i1 %12), !dbg !42, !plsan.instrument !15
in function main
fatal error: error in backend: Broken function found, compilation aborted!
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 17.0.6 ([email protected]:hygoni/precise-leak-sanitizer.git 56b97ffb5eb0e9a1d7fd18bf49e8cb91374c1924)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/hyeyoo/precise-leak-sanitizer/build/bin
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/builtin_alloca-9db3e8.c
clang: note: diagnostic msg: /tmp/builtin_alloca-9db3e8.sh
clang: note: diagnostic msg:

********************
Compilation Failed : testcases/c/functional/builtin_alloca/builtin_alloca.c

@hygoni
Copy link
Owner Author

hygoni commented Mar 20, 2024

clang-17: /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Instructions.cpp:652: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/hyeyoo/precise-leak-sanitizer/build/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir bzero-3- -disable-free -clear-ast-before-backend -main-file-name bzero-3.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fcoverage-compilation-dir=/home/hyeyoo/precise-leak-sanitizer -resource-dir /home/hyeyoo/precise-leak-sanitizer/build/lib/clang/17 -internal-isystem /home/hyeyoo/precise-leak-sanitizer/build/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-everything -fdebug-compilation-dir=/home/hyeyoo/precise-leak-sanitizer -ferror-limit 19 -fsanitize=precise-leak -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/bzero-3-6a7ac9.o -x c testcases/c/noleak/bzero-3.c
1.	<eof> parser at end of file
2.	Optimizer
 #0 0x00000000044954cc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:602:22
 #1 0x00000000044958d2 PrintStackTraceSignalHandler(void*) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:675:1
 #2 0x000000000449330c llvm::sys::RunSignalHandlers() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Signals.cpp:104:20
 #3 0x0000000004494eef SignalHandler(int) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f367d854df0 __restore_rt (/lib64/libc.so.6+0x54df0)
 #5 0x00007f367d8a154c __pthread_kill_implementation (/lib64/libc.so.6+0xa154c)
 #6 0x00007f367d854d46 gsignal (/lib64/libc.so.6+0x54d46)
 #7 0x00007f367d8287f3 abort (/lib64/libc.so.6+0x287f3)
 #8 0x00007f367d82871b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
 #9 0x00007f367d84dce6 (/lib64/libc.so.6+0x4dce6)
#10 0x0000000003bd3b3d llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/IR/Instructions.cpp:651:3
#11 0x0000000000df4292 llvm::CallInst::CallInst(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&, llvm::Instruction*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instructions.h:1720:7
#12 0x0000000000df4132 llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*>>, llvm::Twine const&, llvm::Instruction*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/Instructions.h:1532:64
#13 0x0000000000df4601 llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/IRBuilder.h:2339:36
#14 0x0000000000df46ee llvm::IRBuilderBase::CreateCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::MDNode*) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/IRBuilder.h:2361:22
#15 0x00000000062e9cff PreciseLeakSanitizer::CreateCallWithMetaData(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:358:50
#16 0x00000000062e86ec PreciseLeakSanVisitor::visitMemIntrinsics(llvm::MemIntrinsic&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:198:33
#17 0x00000000062e9c3e PreciseLeakSanitizer::run() /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:349:51
#18 0x00000000062e9d99 PreciseLeakSanitizerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/lib/Transforms/Instrumentation/PreciseLeakSanitizer.cpp:366:78
#19 0x00000000047f30c4 llvm::detail::PassModel<llvm::Module, PreciseLeakSanitizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManagerInternal.h:90:3
#20 0x0000000003c86cbe llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/hyeyoo/precise-leak-sanitizer/llvm/include/llvm/IR/PassManager.h:521:20
#21 0x00000000047db02d (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1083:12
#22 0x00000000047db585 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1141:21
#23 0x00000000047dc571 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/BackendUtil.cpp:1303:25
#24 0x0000000005d8de3a clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:386:24
#25 0x0000000007d82f3c clang::ParseAST(clang::Sema&, bool, bool) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Parse/ParseAST.cpp:183:14
#26 0x000000000537d822 clang::ASTFrontendAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1173:11
#27 0x0000000005d8a67f clang::CodeGenAction::ExecuteAction() /home/hyeyoo/precise-leak-sanitizer/clang/lib/CodeGen/CodeGenAction.cpp:1208:5
#28 0x000000000537d13b clang::FrontendAction::Execute() /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/FrontendAction.cpp:1063:38
#29 0x00000000052b356e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/hyeyoo/precise-leak-sanitizer/clang/lib/Frontend/CompilerInstance.cpp:1053:42
#30 0x000000000550f600 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/hyeyoo/precise-leak-sanitizer/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38
#31 0x0000000000d09ae6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/cc1_main.cpp:249:40
#32 0x0000000000cfadb2 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:366:20
#33 0x0000000000cfb2c4 clang_main(int, char**, llvm::ToolContext const&) /home/hyeyoo/precise-leak-sanitizer/clang/tools/driver/driver.cpp:407:26
#34 0x0000000000d2d09a main /home/hyeyoo/precise-leak-sanitizer/build/tools/clang/tools/driver/clang-driver.cpp:15:58
#35 0x00007f367d83feb0 __libc_start_call_main (/lib64/libc.so.6+0x3feb0)
#36 0x00007f367d83ff60 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3ff60)
#37 0x0000000000cf9365 _start (/home/hyeyoo/precise-leak-sanitizer/build/bin/clang-17+0xcf9365)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.6 ([email protected]:hygoni/precise-leak-sanitizer.git 56b97ffb5eb0e9a1d7fd18bf49e8cb91374c1924)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/hyeyoo/precise-leak-sanitizer/build/bin
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/bzero-3-aaa1ef.c
clang: note: diagnostic msg: /tmp/bzero-3-aaa1ef.sh
clang: note: diagnostic msg:

********************
Compilation Failed : testcases/c/noleak/bzero-3.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants