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 let frame optimization #177

Closed
joe-p opened this issue Oct 19, 2023 · 0 comments · Fixed by #182
Closed

Fix let frame optimization #177

joe-p opened this issue Oct 19, 2023 · 0 comments · Fixed by #182
Labels
bug Something isn't working

Comments

@joe-p
Copy link
Contributor

joe-p commented Oct 19, 2023

foo(a: uint64) {
  assert(a[0])
  let b = a
  b = [1,2,3]
}

Will generate the following TEAL, which retroactively overwrites the value of the arg. I think this should be fixed when #176 is fixed.

        // tests/contracts/general.algo.ts:102
	// assert(a[0])
	byte 0x000000000000000100000000000000020000000000000003 // a: uint64[]
	store 0 // full array
	load 0 // full array
	extract 0 8
	btoi
	assert

	// tests/contracts/general.algo.ts:105
	// b = [1, 2, 3]
	byte 0x000000000000000100000000000000020000000000000003
	frame_bury -1 // b: uint64[] HERE
	retsub
@joe-p joe-p added this to the Stable Release milestone Oct 19, 2023
joe-p added a commit that referenced this issue Oct 19, 2023
@joe-p joe-p added the bug Something isn't working label Oct 19, 2023
joe-p added a commit that referenced this issue Oct 21, 2023
@joe-p joe-p added this to TEALScript Oct 23, 2023
@joe-p joe-p moved this to Done in TEALScript Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant