﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1305	Codegen does not set the binding of a protected variable in a function if the binding is an array	Adrian Pop	Adrian Pop	"Loading function:
{{{
function testRandom1
  input Integer seed_start[3] = {23,87,187};
  output Real x;
  protected
    Integer seed[3] = seed_start; // this is set to 0 and not to seed_start!
algorithm
  for i in 1:10 loop
   (x, seed) := random(seed);
   // Modelica.Utilities.Streams.print(""x = "" + String(x,significantDigits=16) + ""\n"");
  end for;
end testRandom1;
}}}
and call it with different values, gets you the same value:
{{{
testRandom1({5,6,13});
0.0592874602539062
testRandom1({6,7,2});
0.0592874602539062
testRandom1({33,21,17});
0.0592874602539062
}}}
This is because seed is not bound to seed_start.\\
This does not happen if the function evaluates via Cevalfunc, \\
but when we generate code for it, the seed array is always zero."	defect	closed	high		Simulation Code Generation	1.6.0	fixed		Adrian Pop Adrian Pop
