Skip to content

Stack allocator panic: missing stack object location #232

Description

@micahscopes

Description

The Sonatina EVM backend panics during code generation with:

thread 'main' panicked at crates/codegen/src/isa/evm/mod.rs:3498:32:
missing stack object location for obj 21

Reproduction

The rosetta-fe poseidon example triggers this:

cd rosetta-fe/examples/poseidon/fe
fe build

The Fe source uses a custom Fp struct with Add/Mul trait implementations that call addmod/mulmod, combined with array indexing and loops. The combination of operator overloading + array manipulation seems to produce IR that the stack allocator can't handle.

Backtrace

sonatina_codegen::isa::evm::FinalAlloc::rewrite_actions
<sonatina_codegen::isa::evm::FinalAlloc as sonatina_codegen::stackalloc::Allocator>::read
<sonatina_codegen::isa::evm::EvmBackend as sonatina_codegen::machinst::lower::LowerBackend>::lower
sonatina_codegen::machinst::lower::Lower<Op>::lower
sonatina_codegen::isa::evm::EvmBackend::lower_prepared_function

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions