Skip to content

Solidity Compiler Error 9467: Inline Assembly Variables With 'slot' Suffix Causing False Identifier Not Found Errors #16018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
s4bot3ur opened this issue Apr 20, 2025 · 0 comments
Labels

Comments

@s4bot3ur
Copy link

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)
        }
}

-->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant