Skip to content

Commit

Permalink
fix[codegen]: fix double eval in dynarray append/pop (#4030)
Browse files Browse the repository at this point in the history
append/pop does not have an eval once fence for the cases where it is in
memory. add a fence.
  • Loading branch information
charles-cooper authored May 18, 2024
1 parent 0453f63 commit 1cfdfda
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 1cfdfda

Please sign in to comment.