﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5201	Problem in generated code from Modelica.Media mixture	Francesco Casella	Willi Braun	"Please check [https://libraries.openmodelica.org/branches/newInst/Modelica_trunk/files/Modelica_trunk_Modelica.Media.Examples.TestOnly.IdealGasN2Mix.err Modelica.Media.Examples.TestOnly.IdealGasN2Mix]. The C code compilation fails in correspondence to this code:
{{{
/*
 equation index: 2
 type: SIMPLE_ASSIGN
 medium._MM = 1.0 / sum(medium.state.X[j] / {0.0280134} for j in 1:1)
 */
void Modelica_Media_Examples_TestOnly_IdealGasN2Mix_eqFunction_2(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int equationIndexes[2] = {1,2};
  modelica_real tmp0;
  {
    modelica_real $P$tmpVar179;
    real_array tmp1;
    modelica_real $P$tmpVar178;
    int tmp2;
    modelica_integer tmp3;
    modelica_integer tmp4;
    modelica_integer $Pj;
    tmp3 = 1 /* Range step-value */;
    tmp4 = ((modelica_integer) 1) /* Range stop-value */;
    $Pj = ((modelica_integer) 1) /* Range start-value */;
    $Pj = (((modelica_integer) 1) /* Range start-value */)-tmp3;
    $P$tmpVar179 = 0.0; /* defaultValue */
    while(1) {
      tmp2 = 1;
      if (tmp3 > 0 ? $Pj+tmp3 <= tmp4 : $Pj+tmp3 >= tmp4) {
        $Pj += tmp3;
        tmp2--;
      }
      if (tmp2 == 0) {
        real_array_create(&tmp1, ((modelica_real*)&((&data->localData[0]->realVars[22] /* medium.X[1] variable */)[calc_base_index_dims_subs(1, 1, (modelica_integer)$Pj)])), 1, 1);
        $P$tmpVar178 = DIVISION_SIM((*real_array_element_addr1(&tmp1, 1, /* modelica_integer */ (modelica_integer)$Pj)),_OMC_LIT25,""{0.0280134}"",equationIndexes);
      } else if (tmp2 == 1) {
        break;
      } else {
        MMC_THROW_INTERNAL();
      }
    }
    tmp0 = $P$tmpVar179;
  }
  data->localData[0]->realVars[19] /* medium.MM variable */ = DIVISION_SIM(1.0,tmp0,""sum(medium.state.X[j] / {0.0280134} for j in 1:1)"",equationIndexes);
  TRACE_POP
}
}}}
Apparently, something goes wrong with the code generated from
{{{
 medium._MM = 1.0 / sum(medium.state.X[j] / {0.0280134} for j in 1:1)
}}}
I guess the root cause is the same as in #5200, please check."	defect	closed	blocker	1.14.0	Backend		fixed		Lennart Ochel Martin Sjölund
