argotorg / argotorg/solidity

ICE in `ArrayType::storageSize` when a struct containing an oversized 2D array is used in a dynamic array

Open
#16,618 1 comment 0 reactions 0 assignees View on GitHub
bug :bug: low effort low impact nice to have
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

The compiler emits `InternalCompilerError: Uncaught exception` from [`libsolidity/ast/Types.cpp:1834`](https://github.com/ethereum/solidity/blob/9be66192f9db40e5a43f71fc78e06b2f35e9ccdd/libsolidity/ast/Types.cpp#L1834) inside `ArrayType::storageSize()` when computing the storage layout of a struct that contains a 2D array whose total slot count overflows `uint256`.

MRE:
```solidity
contract C {
struct S { uint64[340282366920938463463374607431768211458][1701411834604692317316873037158841057281] x; }
S[] p;
}
```

Reproduce: save as `mre.sol`, run `solc --standard-json` with the file as input (the ICE appears in the JSON `errors` array as `InternalCompilerError`). With `--bin` the compiler exits 0 with warnings only, masking the error.

Output (standard JSON):
```
InternalCompilerError: Uncaught exception:
/solidity/libsolidity/ast/Types.cpp(1834): Throw in function virtual solidity::u256 solidity::frontend::ArrayType::storageSize() const
Dynamic exception type: boost::wrapexcept
std::exception::what: Array too large for storage.
[solidity::util::tag_comment*] = Array too large for storage.
```

Expected behavior: a type error at the array declaration explaining the type exceeds the maximum storage size.

Also reproduces with `uint256` element type and with `mapping(uint => S)` instead of `S[]`.

Git commit: 9be66192f
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++

Contributor guide

Open the contributing guide

Research direction

Start with libsolidity/ast/Types.cpp:1834 and reproduce the issue using the supplied mre.sol with solc --standard-json. Trace how ArrayType::storageSize() handles the overflowing 2D array when computing a struct's storage layout. Done means the declaration produces a type error explaining that the type exceeds the maximum storage size, rather than an InternalCompilerError; also check the --bin and mapping cases described.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.