SSA CFG codegen emits library placeholders for internal libraries
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Description
The SSA CFG-based code generation sometimes emits library placeholders for internal libraries. This occurs only when using a non-standard yul optimization sequence (in this case the standard one without UnusedPruners (u) steps).
## Environment
- Compiler version: 0.8.35+commit.47b9dedd
- Compilation pipeline (legacy, IR, EOF): IR + experimental SSA CFG
- Target EVM version (as per compiler settings): osaka
- Framework/IDE (e.g. Foundry, Hardhat, Remix): NA
- EVM execution environment / backend / blockchain client: NA
- Operating system: macOS arm64 and linux x86-64
## Steps to Reproduce
**target.sol**
```solidity
pragma solidity ^0.8.35;
library L {
function f() internal returns (uint256) {
return 1;
}
}
contract N {
function p() external {}
}
contract PlaceholderContract {
function check_entrypoint() public {
(new N()).p();
assert(L.f() == 1);
}
}
```
**cli command (experimental w/ placeholder)**
```
solc --bin-runtime --optimize --optimize-runs 100 --via-ssa-cfg --experimental --evm-version osaka --yul-optimizations 'dhfoD[xarrscLMcCTU]ljml:fDnTOcm' target.sol
```
Produces bytecode containing a library placeholder. (not expected)
```
6080....5b73__$825ecdb7db853ecb5831abd3822386e16e$__61014...0041
```
**cli command (non experimental)**
```
solc --bin-runtime --optimize --optimize-runs 100 --evm-version osaka --yul-optimizations 'dhfoD[xarrscLMcCTU]ljml:fDnTOcm' target.sol
```
Produces bytecode without library placeholders. (expected)
## Expected Behavior
All functions in the library are marked as internal and should be embedded directly without needing to link to a library. The legacy compile pipeline as well as via-IR using the same compiler options do not emit library placeholders in this case.
Contributor guide
Assessment
This issue has not been assessed yet.