Skip to content

Fix Yul renaming woes - Alloc before Assign#340

Open
mbenke wants to merge 4 commits intomainfrom
mbenke/fix328
Open

Fix Yul renaming woes - Alloc before Assign#340
mbenke wants to merge 4 commits intomainfrom
mbenke/fix328

Conversation

@mbenke
Copy link
Collaborator

@mbenke mbenke commented Mar 20, 2026

Extension of the fix for #188 done in #326: declare/allocate the variable before assigning to it. The problem was e.g. with

 function copyToMem(reader:MemoryWordReader, dst:word, cnt: word) -> () {
      match reader {
      | MemoryWordReader(ptr) => assembly { mcopy(dst, ptr, cnt) }
      }
  }

where match for one-constructor types is eliminated and the body compiles to just asm:

function copyToMem(reader:MemoryWordReader, dst:word, cnt: word) -> () {
  assembly { mcopy(dst, ptr, cnt) }
}

...but now ptr is undefined. The fix in #326 in this case adds an assignment ptr = reader (on MAST level, so there is no type mismatch issue). This PR adds the missing declaration (or actually an allocation for ptr)

Copy link
Collaborator

@rodrigogribeiro rodrigogribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from new-matching-compiler to main March 21, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants