argotorg / argotorg/solidity

ICE for calldata parameter in an internal function

Open
#16,223 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

The following code triggers the ICE shown bellow in the latest solc version ```0.8.30```. The problem seems to appear with version ```0.6.9``` (tested on remix), which is when ```calldata``` location was permitted for internal functions.

## Steps to Reproduce

```testcase.sol```

```solidity
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.8.30;

contract C {
function f(S[10] calldata p) internal {
}
}

struct S {
function () internal pure m1;
}
```

```
solc testcase.sol
```

```
Internal compiler error:
/solidity/libsolidity/ast/Types.cpp(2295): Throw in function virtual bool solidity::frontend::StructType::isDynamicallyEncoded() const
Dynamic exception type: boost::wrapexcept
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed
```

## Environment

- Compiler version: ```0.8.30```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with testcase.sol using solc 0.8.30, then inspect solidity/libsolidity/ast/Types.cpp around line 2295, where the reported assertion is thrown. Done is confirmed when this input no longer produces the reported internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.