Opened 10 years ago
Last modified 10 years ago
#2837 closed defect
Wrong code generation for model — at Version 1
Reported by: | Adrian Pop | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: | Willi Braun |
Description (last modified by )
This pattern is not properly supported in the back-end or code generation:
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.
Note:
See TracTickets
for help on using tickets.