MemorySanitizer: use-of-uninitialized-value
#0 0x49c05839 in llvm::iplist_impl<llvm::simple_ilist<llvm::MachineInstr, llvm::ilist_sentinel_tracking<true>>, llvm::ilist_traits<llvm::MachineInstr>>::~iplist_impl() MachineBasicBlock.cpp
#1 0x49c05c5f in llvm::MachineBasicBlock::~MachineBasicBlock() (/usr/bin/clickhouse+0x49c05c5f) (BuildId:
...
#13 0x41784edf in DB::JITCompiler::compile(llvm::Module&) build_docker/../src/Interpreters/JIT/CHJIT.cpp:78:22
#14 0x4178047d in DB::CHJIT::compileModule(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module>>) build_docker/../src/Interpreters/JIT/CHJIT.cpp:378:29
#15 0x4177f6ed in DB::CHJIT::compileModule(std::__1::function<void (llvm::Module&)>) build_docker/../src/Interpreters/JIT/CHJIT.cpp:359:24
...
play ci
After investigation there is bug detected with memory sanitized in LLVM-12 that I cannot reproduce in LLVM-15. Compilation example:
Result IR:
Such IR generate memory sanitizer warning
use-of-uninitialized-value
somewhere inMachineBlock
destructor. In can be potentially fixed in LLVM-12, trying to rewrite loop using other strategies but it does not look like a proper solution. In LLVM-15 generated IR (with OpaquePointers) would look like this:And it does not produce any memory sanitizer warnings during compilation. I checked other memory sanitizer crashes, and all of them can be fixed with LLVM 15 migration.