Skip to content

Commit

Permalink
Fix stack overflow
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24473 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 7, 2015
1 parent 887a839 commit 9e45cdf
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -934,7 +934,7 @@ protected function selectSecondaryParameters
input array<Integer> inSecondaryParams;
output array<Integer> outSecondaryParams;
algorithm
outSecondaryParams := matchcontinue(inOrdering)
outSecondaryParams := match inOrdering
local
Integer i;
array<Integer> secondaryParams;
Expand All @@ -947,25 +947,13 @@ algorithm
// fixed=false
case i::rest equation
param = BackendVariable.getVarAt(inParameters, i);
false = BackendVariable.varFixed(param);

secondaryParams = List.fold(inM[i], markIndex, inSecondaryParams);
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, secondaryParams);
then secondaryParams;

// fixed=true, but dependent
case i::rest equation
1 = inSecondaryParams[i];

secondaryParams = List.fold(inM[i], markIndex, inSecondaryParams);
secondaryParams = if (not BackendVariable.varFixed(param)) or 1 == inSecondaryParams[i]
then List.fold(inM[i], markIndex, inSecondaryParams)
else inSecondaryParams;
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, secondaryParams);
then secondaryParams;

// primary
case i::rest equation
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, inSecondaryParams);
then secondaryParams;
end matchcontinue;
end match;
end selectSecondaryParameters;

protected function flattenParamComp
Expand Down

0 comments on commit 9e45cdf

Please sign in to comment.