Skip to content

Commit 9e45cdf

Browse files
committed
Fix stack overflow
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24473 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 887a839 commit 9e45cdf

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

Compiler/BackEnd/Initialization.mo

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ protected function selectSecondaryParameters
934934
input array<Integer> inSecondaryParams;
935935
output array<Integer> outSecondaryParams;
936936
algorithm
937-
outSecondaryParams := matchcontinue(inOrdering)
937+
outSecondaryParams := match inOrdering
938938
local
939939
Integer i;
940940
array<Integer> secondaryParams;
@@ -947,25 +947,13 @@ algorithm
947947
// fixed=false
948948
case i::rest equation
949949
param = BackendVariable.getVarAt(inParameters, i);
950-
false = BackendVariable.varFixed(param);
951-
952-
secondaryParams = List.fold(inM[i], markIndex, inSecondaryParams);
953-
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, secondaryParams);
954-
then secondaryParams;
955-
956-
// fixed=true, but dependent
957-
case i::rest equation
958-
1 = inSecondaryParams[i];
959-
960-
secondaryParams = List.fold(inM[i], markIndex, inSecondaryParams);
950+
secondaryParams = if (not BackendVariable.varFixed(param)) or 1 == inSecondaryParams[i]
951+
then List.fold(inM[i], markIndex, inSecondaryParams)
952+
else inSecondaryParams;
961953
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, secondaryParams);
962954
then secondaryParams;
963955

964-
// primary
965-
case i::rest equation
966-
secondaryParams = selectSecondaryParameters(rest, inParameters, inM, inSecondaryParams);
967-
then secondaryParams;
968-
end matchcontinue;
956+
end match;
969957
end selectSecondaryParameters;
970958

971959
protected function flattenParamComp

0 commit comments

Comments
 (0)