﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1262	Modelica-function's local variables do not get initialized!	asodja	asodja	"Local variables of functions are not initialized in the generated code.

Consider the following example:
{{{function testFcn
  output Real res;
protected
  Real coef = -42.0;
algorithm
  res := coef;
end testFcn;}}}
The generated code for the function is:
{{{fcnLocalValInit_testFcn_rettype _fcnLocalValInit_testFcn()
{
  fcnLocalValInit_testFcn_rettype tmp1;
  state tmp2;
  modelica_real res;
  modelica_real coef;
  tmp2 = get_memory_state();


  res = coef;

  _return:
  tmp1.targ1 = res;
  restore_memory_state(tmp2);
  return tmp1;
}
}}}
As it can be seen, the variable coef is never initialized, so function returns arbitrary value!

Initialization of local variables are also used in Modelica Standard Library, 
for example, in {{Modelica.Blocks.Sources.TimeTable.getInterpolationCoefficients}}!"	defect	closed	high		Code Generation	1.6.0	fixed		asodja Per Östlund
