﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2837	Wrong code generation for model	Adrian Pop	Lennart Ochel	"This pattern is not properly supported in the back-end or code generation:
{{{#!mo
model ArrayModel

   function lift
      input Real x;
      input Real y;
      output Real[1] z;
    algorithm
      z := {x};
    end lift;
    
    parameter Real x = 10;
    Real z[1];
equation
    z = lift(x, 0.0);
end ArrayModel;
}}}

We get:
{{{
ArrayModel_06inz.c: In function 'ArrayModel_eqFunction_1':
ArrayModel_06inz.c:71: error: incompatible types when assigning to type 'modelica_real' from type 'real_array_t'
}}}
and codegen looks like:
{{{
/*
 equation index: 1
 type: SIMPLE_ASSIGN
 z[1] = (ArrayModel.lift(x, 0.0) - z) ./ {1.0}
 */
void ArrayModel_eqFunction_1(DATA *data)
{
  const int equationIndexes[2] = {1,1};
  TRACE_PUSH
  real_array tmp0;
  real_array_create(&tmp0, ((modelica_real*)&($Pz)), 1, 1);
  $Pz$lB1$rB = div_alloc_real_array(sub_alloc_real_array(omc_ArrayModel_lift(threadData, $Px, 0.0), tmp0), _OMC_LIT0);
  TRACE_POP
}
}}}
Which seems rather wrong.

This kind of pattern is used in the PowerSystems library."	defect	closed	high	1.9.1	Backend	trunk	fixed		Willi Braun
