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[codegen]: fix double eval in dynarray append/pop #4030

Merged
merged 2 commits into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions vyper/codegen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ def append_dyn_array(darray_node, elem_node):
)

# store new length
ret.append(STORE(darray_node, ["add", len_, 1]))
ret.append(ensure_eval_once("append_dynarray", STORE(darray_node, ["add", len_, 1])))

return IRnode.from_list(b1.resolve(b2.resolve(ret)))


Expand All @@ -415,7 +416,7 @@ def pop_dyn_array(darray_node, return_popped_item):

with new_len.cache_when_complex("new_len") as (b2, new_len):
# store new length
ret.append(STORE(darray_node, new_len))
ret.append(ensure_eval_once("pop_dynarray", STORE(darray_node, new_len)))

# NOTE skip array bounds check bc we already asserted len two lines up
if return_popped_item:
Expand Down
Loading