simit icon indicating copy to clipboard operation
simit copied to clipboard

Can't assign to component of blocked system matrix in assembly

Open fredrikbk opened this issue 8 years ago • 0 comments

The following code:

func asm(e : Edge, v : (Vertex*2)) -> K : matrix[V,V](matrix[2, 2](int))
  K(v(0),v(0))(0, 0) = 1;  % error because we're assigning to component
end

triggers the assert

Compiler bug at /Users/kjoelsta/Dropbox/projects/simit/simit/src/lower/lower_maps.cpp:109 in visit
Please report it to http://issues.simit-lang.org
 Condition failed: isa<TupleRead>(index) || isa<VarExpr>(index)
 0 is not a tuple read or a var expr
 IR stack:
 ... K(v(0),v(0))(0,0) = 1;
 ... As = map asm to E with V reduce +;
 ... func main

Test case in 7b91251b2646314ee96853c44b9efce503a227e4.

Temporary workaround:

  var k : matrix[2,2](int) = 0;
  k(0,0) = 1;
  K(v(0),v(0)) = k;

fredrikbk avatar Aug 24 '16 17:08 fredrikbk