hyperledger / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.25k stars 208 forks source link

Solang generates incorrect LLVM IR for multidimensional arrays #903

Open LucasSte opened 2 years ago

LucasSte commented 2 years ago

This contract works fine for solc, but crashes on Solang (for all targets):

contract Testing {

    uint16[2][4][] stor_arr;
    function getThis() public returns (uint16) {
        uint16[2][4][] memory arr2 = stor_arr;
        return arr2[1][2][2];
    }
}
LucasSte commented 2 years ago

This is the error I get:

solang: /home/lucas/Downloads/llvm-project/llvm/include/llvm/IR/Instructions.h:921: llvm::Type* llvm::checkGEPType(llvm::Type*): Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed.