llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.11k stars 12.01k forks source link

Regression in Bitcode Reader caused by r247927 #25475

Closed tstellar closed 9 years ago

tstellar commented 9 years ago
Bugzilla Link 25101
Resolution FIXED
Resolved on Oct 12, 2015 14:45
Version trunk
OS Linux
Attachments Script to reproduce, Program bitcode, Library bitcode

Extended Description

r247927 has caused a regression where llvm-dis hits an assertion failure when trying to disassemble bitcode that has been output by the linker:

lib/Bitcode/Reader/BitcodeReader.cpp:4965: std::error_code {anonymous}::BitcodeReader::findFunctionInStream(llvm::Function, llvm::DenseMapBase<llvm::DenseMap<llvm::Function, long unsigned int>, llvm::Function, long unsigned int, llvm::DenseMapInfo<llvm::Function>, llvm::detail::DenseMapPair<llvm::Function*, long unsigned int> >::iterator): Assertion `VSTOffset == 0' failed.

To reproduce place the attached files program.bc and library.bc in the same directory has link.sh and then execute the link.sh script.

Note that program.bc was generated by LLVM 3.5, and I think library.bc was from LLVM 3.6.

llvmbot commented 9 years ago

Fixed at r249947.

llvmbot commented 9 years ago

Patch with fix and testcase out for review at http://reviews.llvm.org/D13596

llvmbot commented 9 years ago

I found that this due to unnamed functions created during the link for use in library functions also generated during the link. These unnamed functions don't have entries in the Value Symbol Table and thus we can't look up their bitcode offset. I am thinking about some ways to handle this.

llvmbot commented 9 years ago

Reproduced, taking a look.