Description
Description
The Solidity compiler is incorrectly interpreting variable names in inline assembly that end with "_slot" (e.g., "from_slot") as attempts to access storage variables rather than as locally declared assembly variables. This causes compilation error 9467: "Identifier not found. Use '.slot' and '.offset' to access storage or transient storage variables."
When using variable names like "from_slot" or "to_slot" in inline assembly, the compiler mistakenly interprets these as attempts to access storage slot properties. However, when the same variables are renamed to "slot_from" or "slot_to" (moving the word "slot" to the beginning), the code compiles successfully. This suggests the compiler is incorrectly parsing variable names that end with "_slot".
Environment
- Compiler version:0.8.28
Steps to Reproduce
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
contract test{
function transfer(address _to, uint256 _value)public{
assembly{
let ptr:=mload(0x40)
mstore(ptr,caller())
mstore(add(ptr,0x20),1)
let from_slot:=keccak256(ptr,0x40)
let from_Balance:=sload(from_slot)
}
}
-->