You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This causes the memory location of x[0] to be overwritten before it gets copied to x[1].
@publicdefbug(x_unsorted: uint256[2]) ->uint256:
# Initial valuex: uint256[2] =x_unsortedx= [x[1], x[0]] # bug!# x is now equal to [ x_unsorted[1], x_unsorted[1] ]returnx[0]
# But when it's x = [x_unsorted[1], x_unsorted[0]] - all good
I'm guessing a similar issue exists for contract variables.
How can it be fixed?
Well, fix make_setter, but it's unclear what the best approach is. The first obvious fix is just to process all the loads before all the stores, but this breaks for byte arrays (because those don't use the stack at all, they use memcpy macros).
The text was updated successfully, but these errors were encountered:
probably the most sane thing to do here is, first detect if the RHS depends on the LHS. if there is a dependency, then make_setter to a temporary buffer and then run make_setter on that to the LHS.
charles-cooper
changed the title
make_setter is incorrect for complex types when the RHS references the LHS
assignment is incorrect for complex types when the RHS references the LHS
May 14, 2023
charles-cooper
changed the title
assignment is incorrect for complex types when the RHS references the LHS
make_setter is incorrect for complex types when the RHS references the LHS
May 14, 2023
Version Information
vyper --version
): 0.2.15What's your issue about?
This causes the memory location of x[0] to be overwritten before it gets copied to x[1].
On 0.2.15 this produces code like
This has been there for awhile, even in 0.2.0 we get
I'm guessing a similar issue exists for contract variables.
How can it be fixed?
Well, fix make_setter, but it's unclear what the best approach is. The first obvious fix is just to process all the loads before all the stores, but this breaks for byte arrays (because those don't use the stack at all, they use memcpy macros).
The text was updated successfully, but these errors were encountered: