solang icon indicating copy to clipboard operation
solang copied to clipboard

[ICE]: Assigning to mapping in uninitialized storage struct causes error

Open Subway2023 opened this issue 8 months ago • 0 comments

Solang version: v0.3.3-70-g32a45ea1 Description: c.a[0] = new uint; causes a compilation error.

contract C {
    struct S { mapping(uint => uint[]) a; }
    function f(bool b) public {
        S storage c;
        assembly {
            c.slot := 0
        }
        c.a[0] = new uint[](1);
    }
}
solang_v0.3.3: llvm/lib/IR/Constants.cpp:2271: static llvm::Constant* llvm::ConstantExpr::get(unsigned int, llvm::Constant*, llvm::Constant*, unsigned int, llvm::Type*): Assertion `C1->getType() == C2->getType() && "Operand types in binary constant expression should match"' failed.
/mnt/subw3/crossCompilerFuzz/compiler/bin/solangcom: line 6: 641488 Aborted                 (core dumped) /mnt/subw3/crossCompilerFuzz/compiler/bin/solang_v0.3.3 compile --target solana "$1" -o /mnt/subw3/crossCompilerFuzz/output/temp

Subway2023 avatar Apr 16 '25 03:04 Subway2023