Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: X10 2.2
-
Fix Version/s: X10 2.3.2
-
Labels:None
-
Number of attachments :
Description
The expression flattener is interfering with the Vec class. This is particularly problematic in the java backend where the flattener is on by default.
The flattener causes an extra value assignment in the case of vec_sized1(15) = a; that causes the side-effect to be lost
//#line 28 "/home/spark/work/x10-dbg/x10.tests/examples/Constructs/Structs/VectorTest.x10" final x10.core.Vec<$T> t2438 = ((x10.core.Vec)(vec_sized1)).clone(); //#line 28 "/home/spark/work/x10-dbg/x10.tests/examples/Constructs/Structs/VectorTest.x10" x10.runtime.util.Util.eval(((x10.core.Vec<$T>)(t2438)).set(((int)(15)),a));
also
//#line 28 "/home/spark/work/x10-dbg/x10.tests/examples/Constructs/Structs/VectorTest.x10": x10.ast.X10LocalDecl_c
x10::util::NativeVec<TPMGL(T), 20> t2438 = vec_sized1;
//#line 28 "/home/spark/work/x10-dbg/x10.tests/examples/Constructs/Structs/VectorTest.x10": polyglot.ast.Eval_c
t2438.set(a,((x10_int)15));
I am not sure how to fix this.
The flattener could avoid flattening lvalues.
A simple definition of lvalue that would suffice for VectorTest would be 'an lvalue is a variable or parameter'
I don't see there is any reason to flatten such things anyway, so this would help with readability.