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
fnmain(x:bool){let foo = [1,2,3];let bar = [4,5,6];// == true is required because of a parsing buglet y = if x == true{ foo }else{ bar };
constrain y[0] == 12;}
Expected Behavior
Valid SSA output
Bug
After flattening, the output is:
fn main f1 {
b0(v0:u1):
v1 = alloc 3 fields
store Field1 at v1
v3 = add v1,Field1
store Field2 at v3
v5 = add v1,Field2
store Field3 at v5
v7 = alloc 3 fields
store Field4 at v7
v9 = add v7,Field1
store Field5 at v9
v11 = add v7,Field2
store Field6 at v11
v13 = eq v0,Field1
v19 = not v13
v20 = mul v13, v1 // multiplying the condition times an address is likely invalid.
v21 = mul v19, v7
v22 = add v20, v21 // adding the two multiplied addresses together is also likely invalid.
v23 = load v22
v24 = eq v23,Field12
constrain v24
return unit 0}
To Reproduce
Installation Method
None
Nargo Version
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered:
The current SSA form recurses on each element of each array and merges those instead. So we'd have one set of mul, mul, add instructions for each element rather than just the one currently that is being applied to the array address.
Give array addresses actual numerical values. This likely entails managing a shared memory abstraction.
I don't think approach 2 would work for non-constant conditions ince the generated ACIR would have to have some way of retrieving the correct address given a witness.
Aim
Tried to return an array from an if statement:
Expected Behavior
Valid SSA output
Bug
After flattening, the output is:
To Reproduce
Installation Method
None
Nargo Version
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: