Got a "corrupted double-linked list" error?


Recently,I write some code to implement the following funtions:

I make use the codes of "llvm-dis" to disassemble the bitcode file and
do some change on it,after that ,"my llvm-as" assembles the changed file
to generate a bitcode file.

But I got a "corrupted double-linked list" error when "my llvm-as"
works,however,when I do nothing on the disassembled bitcode
file,everything is OK,

After debugged,I found the error line is

"MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(),

in the "Module *llvm::ParseAssemblyFile(const std::string &Filename,
SMDiagnostic &Err,LLVMContext &Context)" function,

I don't know the reason,anyone once got the similar trouble?


This can be due to invalid memory free. Try using valgrind and check for possible memory corruption.