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
Hello,
I noticed that when using arrays, the value of an element is sometimes not updated right away.
Here is an example:
arr=sint.Array(1)
arr.assign_all(42)
# change arr[0] to 0new_value=sint(0) *sint(0)
arr.assign(new_value, cint(0))
# use arr[0] in a calculation. Should result in 0times_one=arr[0] *sint(1)
# prints `0 ; 42`print_ln('%s ; %s', arr[0].reveal(), times_one.reveal())
Assigning new_value to arr[0] only takes effect after calculating the value of times_one.
During the calculation, arr[0] seems to still be 42.
After a bit of trial and error, I found out that the bug disappears in the following cases:
if no multiplication is involved when calculating new_value or times_one
if not both operands of the two multiplications are secret
if we use a python integer instead of a cint in arr.assign
Thanks for looking into this!
The text was updated successfully, but these errors were encountered:
This is because the compiler cannot recognise that the cint(0) is the same as 0. You can either introduce a break_point() after the assign call or surround the commands with memory protection:
Again, the wrong output does not occur if there is no secret multiplication before/after the assignment of sint(0) to arr[0].
Introducing a break_point() after one of the assigns also fixes it. protect_memory or compiling with -M does not solve the issue here however.
Does that mean I have to add a break_point() after every assign to make sure the value is updated in time?
Hello,
I noticed that when using arrays, the value of an element is sometimes not updated right away.
Here is an example:
Assigning
new_value
toarr[0]
only takes effect after calculating the value oftimes_one
.During the calculation,
arr[0]
seems to still be42
.After a bit of trial and error, I found out that the bug disappears in the following cases:
new_value
ortimes_one
cint
inarr.assign
Thanks for looking into this!
The text was updated successfully, but these errors were encountered: