Skip to content

Module::write_bitcode_to_path causing segfault #555

@cyccro

Description

@cyccro

While trying to write the bitcode to the given path, it causes sigfault. I don't understand why because before I added some changes it was working correctly. I tried debugging it and the call stack that appears in vscode is the following:

(anonymous namespace)::ModuleBitcodeWriter::pushValueAndType(llvm::Value const*, unsigned int, llvm::SmallVectorImpl&)
(@(anonymous namespace)::ModuleBitcodeWriter::pushValueAndType(llvm::Value const*, unsigned int, llvm::SmallVectorImpl&):35)
(anonymous namespace)::ModuleBitcodeWriter::writeInstruction(llvm::Instruction const&, unsigned int, llvm::SmallVectorImpl&)
(@(anonymous namespace)::ModuleBitcodeWriter::writeInstruction(llvm::Instruction const&, unsigned int, llvm::SmallVectorImpl&):3651)
(anonymous namespace)::ModuleBitcodeWriter::write()
(@(anonymous namespace)::ModuleBitcodeWriter::write():3818)
llvm::BitcodeWriter::writeModule(llvm::Module const&, bool, llvm::ModuleSummaryIndex const*, bool, std::array<unsigned int, 5ul>)
(@llvm::BitcodeWriter::writeModule(llvm::Module const&, bool, llvm::ModuleSummaryIndex const
, bool, std::array<unsigned int, 5ul>):108)
llvm::WriteBitcodeToFile(llvm::Module const&, llvm::raw_ostream&, bool,llvm::ModuleSummaryIndex const
, bool, std::array<unsigned int, 5ul>) (@llvm::WriteBitcodeToFile(llvm::Module const&, llvm::raw_ostream&, bool, llvm::ModuleSummaryIndex const, bool, std::array<unsigned int, 5ul>*):64)
LLVMWriteBitcodeToFile (@LLVMWriteBitcodeToFile:35)
inkwell::module::Module::write_bitcode_to_path (/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inkwell-0.5.0/src/module.rs:674)
compiler::CodeGenerator::compile_ast (
/Programmation/hdc/compiler/src/lib.rs:60)
compiler::compile_ast (/Programmation/hdc/compiler/src/lib.rs:68)
compiler::compile_from_to (
/Programmation/hdc/compiler/src/lib.rs:75)
hdc::main (~/Programmation/hdc/src/main.rs:36)
... the rest is rust internals

I really have no idea of how to solve this problem.

OS: Linux Mint 21.3
LLVM version: 14.0.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions