Skip to content
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

Fix handling of local assembly variables in ReferencesResolver #14820

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

00guap
Copy link

@00guap 00guap commented Jan 27, 2024

The bug was fixed by modifying the handling of local assembly variables in the ReferencesResolver class.

Here's a breakdown of the changes made:

  • A stack of sets was added to track local assembly variables and their scopes.
  • In the visit and endVisit methods for Block, the local assembly variables stack is updated to push a new set when entering a block and pop it when leaving a block.
  • Now when processing a yul::Identifier, the error reporting for undeclared identifiers with _offset or _slot suffixes is only triggered if the identifier is not found in the current local assembly variables scope.
  • When processing a yul::VariableDeclaration, the local assembly variables set for the current scope is updated with the new variable before checking for shadowed declarations.

Two new test cases were added to verify the correct handling of local assembly variables with _offset and _slot suffixes.

This fixes issue #14589

Copy link

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

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

Successfully merging this pull request may close these issues.

None yet

1 participant