﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5526	MetaModelica: loop over list<Integer>	jens.schoenbohm@…	Lennart Ochel	"Using an Integer from a list<Integer> as array index will give the wrong array component, if the list is part of a record.

Example:
{{{#!mo
uniontype Index
  record INDEX
    list<Integer> idx;
  end INDEX;
end Index;
  
uniontype Compo
  record COMPO
    array<Real> co;
  end COMPO;
end Compo;
}}}
Supposed we have a Compo called compo and an Index called index, the for loop gives wrong array components:
{{{#!mo
for k in index.idx loop
  print(String(k));
  r := compo.co[k];
end for;
}}}
The print command gives the correct number, but k as array index
seems to have twice the value of the list member. So if it exceeds the array bounds we will see an error otherwise r has a wrong value.

A known workaround: Assign k to an integer variable and use it instead of k or do an integer operation with k at the place where you use k. For instance r := compo.co[k+0].
"	defect	new	normal	Future	Code Generation	v1.14.0-dev-nightly			
