Skip to content

DSE handleEndBlock uses freed memory #2352

@llvmbot

Description

@llvmbot
Bugzilla Link 1980
Resolution FIXED
Resolved on Feb 04, 2008 22:34
Version unspecified
OS Linux
Attachments unreduced testcase bitcode, reduced testcase .ll
Reporter LLVM Bugzilla Contributor

Extended Description

Here's what valgrind says:

Invalid read of size 4
at 0x85D2CAB: llvm::ilist_iteratorllvm::Instruction::operator++() (Instruction.h:223)
by 0x87ECBDB: llvm::ilist_iteratorllvm::Instruction::operator++(int) (ilist:152)
by 0x8BAE2CA: llvm::MemoryDependenceAnalysis::removeInstruction(llvm::Instruction*) (MemoryDependenceAnalysis.cpp:469)
by 0x8ABD37A: (anonymous namespace)::DSE::handleEndBlock(llvm::BasicBlock&, llvm::SetVector<llvm::Instruction*, std::vector<llvm::Instruction*, std::allocatorllvm::Instruction* >, llvm::SmallSet<llvm::Instruction*, 16> >&) (DeadStoreElimination.cpp:280)
by 0x8ABE293: (anonymous namespace)::DSE::runOnBasicBlock(llvm::BasicBlock&) (DeadStoreElimination.cpp:182)
by 0x8ABE36E: (anonymous namespace)::DSE::runOnFunction(llvm::Function&) (DeadStoreElimination.cpp:46)
by 0x8C434A7: llvm::FPPassManager::runOnFunction(llvm::Function&) (PassManager.cpp:1184)
by 0x8C43649: llvm::FPPassManager::runOnModule(llvm::Module&) (PassManager.cpp:1204)
by 0x8C4317D: llvm::MPPassManager::runOnModule(llvm::Module&) (PassManager.cpp:1254)
by 0x8C43335: llvm::PassManagerImpl::run(llvm::Module&) (PassManager.cpp:1328)
by 0x8C43387: llvm::PassManager::run(llvm::Module&) (PassManager.cpp:1360)
by 0x8597C5F: llvm_asm_file_end (llvm-backend.cpp:561)
Address 0x7483194 is 36 bytes inside a block of size 72 free'd
at 0x402231C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x8C2EAD8: llvm::StoreInst::~StoreInst() (Instructions.h:293)
by 0x87CF1EC: llvm::iplist<llvm::Instruction, llvm::ilist_traitsllvm::Instruction >::erase(llvm::ilist_iteratorllvm::Instruction) (ilist:368)
by 0x8C1E7A8: llvm::Instruction::eraseFromParent() (Instruction.cpp:68)
by 0x8ABE13A: (anonymous namespace)::DSE::runOnBasicBlock(llvm::BasicBlock&) (DeadStoreElimination.cpp:156)
by 0x8ABE36E: (anonymous namespace)::DSE::runOnFunction(llvm::Function&) (DeadStoreElimination.cpp:46)
by 0x8C434A7: llvm::FPPassManager::runOnFunction(llvm::Function&) (PassManager.cpp:1184)
by 0x8C43649: llvm::FPPassManager::runOnModule(llvm::Module&) (PassManager.cpp:1204)
by 0x8C4317D: llvm::MPPassManager::runOnModule(llvm::Module&) (PassManager.cpp:1254)
by 0x8C43335: llvm::PassManagerImpl::run(llvm::Module&) (PassManager.cpp:1328)
by 0x8C43387: llvm::PassManager::run(llvm::Module&) (PassManager.cpp:1360)
by 0x8597C5F: llvm_asm_file_end (llvm-backend.cpp:561)

I hope this is enough: it is not easy to reproduce using opt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions