argotorg / argotorg/solidity

ICE: Invalid IR generated when assigning calldata struct with external function type member to storage

Open
#16,717 1 comment 0 reactions 1 assignee Claimed by @matheusaaguiar View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

## Description

ICE: Invalid IR generated when assigning calldata struct with external function type member to storage

## Environment

- Compiler version: 0.8.36-develop.2026.5.13+commit.789a0f9d
- Compilation pipeline (legacy, IR, EOF): IR (--via-ir)
- Target EVM version (as per compiler settings): default (cancun, not explicitly set)
- Framework/IDE (e.g. Foundry, Hardhat, Remix): None — direct solc invocation
- EVM execution environment / backend / blockchain client: N/A — the crash occurs at compile time before any bytecode is produced

## Steps to Reproduce

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct C {
function(uint) external fn_uint;
}

contract Test {
C c1;
function f(C calldata src) public {
c1 = src;
}
}
```
```
solc --via-ir --ir struct.sol
# or with optimization:
solc --via-ir --optimize --ir --ir-optimized struct.sol
```

## Actual Behavior
Internal compiler error:
```
…/CompilerStack.cpp(876): Throw in function YulStack solidity::frontend::CompilerStack::loadGeneratedIR(…) const

Invalid IR generated:
Error (3812): Variable count mismatch for declaration of "memberValue_0, memberValue_1": 2 variables and 1 values.
--> :227:21:
|
227 | let memberValue_0, memberValue_1 :=
| ^ (Relevant source part starts here and spans across multiple lines).

Error (7000): Function "read_from_calldatat_function_external_nonpayable$_t_uint256_$returns$__$" expects 1 arguments but got 2.
--> :231:53:
|
231 | ... memberValue_0, memberValue_1 := read_from_calldatat_function_external_nonpayable$_t_uint256_$returns$__$(memberValue_0, memberValue_1)
```

## Expected Behavior
Compilation should succeed and produce correct EVM bytecode equivalent to the --no-via-ir output.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.