[PATCH] D71368: [ MC ] Match labels to existing fragments even when switching sections.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 15:06:29 PST 2019


hctim added inline comments.


================
Comment at: llvm/include/llvm/MC/MCObjectStreamer.h:42
+  SmallVector<MCSection*, 2> PendingLabelSections;
+  unsigned CurSubsectionIdx;
   struct PendingMCFixup {
----------------
vitalybuka wrote:
> Never initialized?
Reverted in `f827aff8598873194bccdfaf469f2dde7e5620d1` due to MSan failures. 

MSan bots are hard to reproduce sometimes due to the multi-stage build. The easiest way to reproduce the problem is via. these instructions: https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild

An example failure is shown below:


```
==83120==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x3d5b7b1 in llvm::MCSection::flushPendingLabels(llvm::MCFragment*, unsigned long, unsigned int) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/MC/MCSection.cpp:102:9
    #1 0x3d4ee6e in insert /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/MC/MCObjectStreamer.h:77:5
    #2 0x3d4ee6e in llvm::MCObjectStreamer::getOrCreateDataFragment(llvm::MCSubtargetInfo const*) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/MC/MCObjectStreamer.cpp:210:5
    #3 0x3d29f57 in llvm::MCELFStreamer::EmitInstToData(llvm::MCInst const&, llvm::MCSubtargetInfo const&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/MC/MCELFStreamer.cpp:584:10
    #4 0x298a7d4 in EmitAndCountInstruction /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:103:16
    #5 0x298a7d4 in llvm::X86AsmPrinter::EmitInstruction(llvm::MachineInstr const*) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:2552:3
    #6 0x42f02a6 in llvm::AsmPrinter::EmitFunctionBody() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    #7 0x296c6b9 in llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Target/X86/X86AsmPrinter.cpp:79:3
    #8 0x5184e4e in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:13
    #9 0x3aaae8a in llvm::FPPassManager::runOnFunction(llvm::Function&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1481:27
    #10 0x3aabcdc in llvm::FPPassManager::runOnModule(llvm::Module&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1517:16
    #11 0x3aad010 in runOnModule /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1582:27
    #12 0x3aad010 in llvm::legacy::PassManagerImpl::run(llvm::Module&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1694:44
    #13 0x3cb5b98 in (anonymous namespace)::codegen(llvm::lto::Config&, llvm::TargetMachine*, std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>, unsigned int, llvm::Module&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/LTO/LTOBackend.cpp:367:17
    #14 0x3cadb15 in llvm::lto::backend(llvm::lto::Config&, std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>, unsigned int, std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >, llvm::ModuleSummaryIndex&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/LTO/LTOBackend.cpp:472:5
    #15 0x3c92b2a in llvm::lto::LTO::runRegularLTO(std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/LTO/LTO.cpp:1015:10
    #16 0x3c90c9a in llvm::lto::LTO::run(std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)>, std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned int)> (unsigned int, llvm::StringRef)>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/LTO/LTO.cpp:945:18
    #17 0x63d1f2 in run(int, char**) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/llvm-lto2/llvm-lto2.cpp:349:13
    #18 0x631362 in main /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/llvm-lto2/llvm-lto2.cpp:449:12
    #19 0x7fcd3aa132e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #20 0x5b4be9 in _start (/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/llvm-lto2+0x5b4be9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/MC/MCSection.cpp:102:9 in llvm::MCSection::flushPendingLabels(llvm::MCFragment*, unsigned long, unsigned int)
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71368





More information about the llvm-commits mailing list