IR codegen does not implement access to library address by contract name
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
Discovered in https://github.com/ethereum/solidity/pull/15661#discussion_r1894361095
## Description
A reference to a library name in inline assembly triggers an unimplemented feature error. At this point the IR codegen is considered feature-complete so this not being implemented yet is a bug.
Moreover the error does not provide any message for the user.
While we do have this case covered by a syntax test ([`assignment_from_library.sol`](https://github.com/ethereum/solidity/blob/develop/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol)), it went undiscovered until now because we don't run syntax tests via IR. When the bug is fixed, please remember to enable this test on EOF.
## Environment
- Compiler version: 0.8.28 (`develop`)
## Steps to Reproduce
`test.sol`:
```solidity
library L {}
contract C {
function f() public pure {
assembly {
let x := L
}
}
}
```
```bash
solc test.sol --ir
```
```
Error: Unimplemented feature
--> test.sol:5:9:
|
5 | assembly {
| ^ (Relevant source part starts here and spans across multiple lines).
```
Contributor guide
Research direction
Start with test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol and reproduce the issue using solc test.sol --ir. Trace the IR codegen path for an inline-assembly library reference; done means the reference is handled without an unimplemented-feature failure, the user receives a message, and the syntax test is enabled on EOF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100