﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2028	Problem in initial residuals	Christian Schubert	Martin Sjölund	"There is a problem with code generation in the initial residuals.

Consider the model
{{{
model TestInitial
  discrete Real T[3,3];
initial equation
  pre(T) = identity(3);
equation
  when sample(1e-8, 1) then
    T = time*identity(3);
  end when;
end TestInitial;
}}}
when simulating it, it gives the error messages
{{{
TestInitial.c: In function 'initial_residual':
TestInitial.c:283: error: lvalue required as unary '&' operand
TestInitial.c:283: warning: passing argument 1 of 'add_alloc_real_array' from incompatible pointer type
C:/Projekte/OpenModelica/build//include/omc/real_array.h:150: note: expected 'const struct real_array_t *' but argument is of type 'modelica_real *'
TestInitial.c:284: error: incompatible types when assigning to type 'double' from type 'real_array'
TestInitial.c:292: error: lvalue required as unary '&' operand
TestInitial.c:292: warning: passing argument 1 of 'add_alloc_real_array' from incompatible pointer type
C:/Projekte/OpenModelica/build//include/omc/real_array.h:150: note: expected 'const struct real_array_t *' but argument is of type 'modelica_real *'
TestInitial.c:293: error: incompatible types when assigning to type 'double' from type 'real_array'
TestInitial.c:301: error: lvalue required as unary '&' operand
TestInitial.c:301: warning: passing argument 1 of 'add_alloc_real_array' from incompatible pointer type
C:/Projekte/OpenModelica/build//include/omc/real_array.h:150: note: expected 'const struct real_array_t *' but argument is of type 'modelica_real *'
TestInitial.c:302: error: incompatible types when assigning to type 'double' from type 'real_array'
TestInitial.c: In function 'eqFunction_3':
TestInitial.c:322: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_5':
TestInitial.c:336: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_7':
TestInitial.c:350: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_9':
TestInitial.c:364: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_11':
TestInitial.c:378: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_13':
TestInitial.c:392: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_15':
TestInitial.c:406: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_17':
TestInitial.c:420: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
TestInitial.c: In function 'eqFunction_19':
TestInitial.c:434: error: incompatible types when assigning to type 'modelica_real' from type 'real_array'
mingw32-make: *** [TestInitial.o] Error 1
}}}

It seems that the Frontend misses transforming a SUB_ARRAY into a SUB while expanding the matrix expressions."	defect	closed	high	1.9.0	Frontend	trunk	fixed		
