﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5225	Nested record assignments causes invalid code to be generated	Per Östlund	Mahder Alemseged Gebremedhin	"Consider a model that contains nested record instance that's assigned in an algorithm section:
{{{#!mo
record R
  Real x;
end R;

record R2
  Real y;
  R r;
end R2;

function f
  output R2 res = R2(1.0, R(2.0));
end f;

model M
  R2 r2;
algorithm
  r2 := f();
end M;
}}}
The assignment is compiled into a function `M_eqFunction_2`, where `r2` at the end of the function is assigned as:
{{{#!c
  data->localData[0]->realVars[1] /* r2.y variable */ = tmp2._y;
  $Pr2$Pr = tmp2._r;
}}}
The first assignment is correct, but the second fails to take into account that `tmp2._r` is itself a record and tried to assign it to the non-existent variable `$Pr2$Pr`.

This pattern is used in the HelmholtzMedia library, for example in [https://libraries.openmodelica.org/branches/newInst/HelmholtzMedia/files/HelmholtzMedia_HelmholtzMedia.Examples.Parameter.setSat_parameter.err HelmholtzMedia.Examples.Parameter.setSat_parameter] (which only works with `-d=newInst`, but this issue occurs also with the old frontend)."	defect	closed	high	1.16.0	Code Generation	v1.13.0-dev-nightly	fixed		
