Skip to content

Commit

Permalink
Fix stack overflow in removeStateDerInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jan 26, 2016
1 parent b1fb7f9 commit 072f8e9
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions Compiler/BackEnd/RemoveSimpleEquations.mo
Expand Up @@ -4532,25 +4532,12 @@ protected function removeStateDerInfo "BB,
remove stateDerInfo! This information should be collected after removeSimpleEquations
"
input list<BackendDAE.Var> inVarList;
output list<BackendDAE.Var> outVarList;
output list<BackendDAE.Var> vars = {};
algorithm
outVarList := matchcontinue(inVarList)
local
BackendDAE.Var var, var1;
DAE.ComponentRef cr;
list<BackendDAE.Var> varsRest;
case ({}) then {};
case (var::varsRest) equation
var = BackendVariable.setStateDerivative(var, NONE());
outVarList = removeStateDerInfo(varsRest);
then (var::outVarList);
case (var::varsRest) equation
outVarList = removeStateDerInfo(varsRest);
then (var::outVarList);
else equation
print("\n++++++++++ Error in RemoveSimpleEquations.removeStateDerInfo ++++++++++\n");
then inVarList;
end matchcontinue;
for var in inVarList loop
vars := (if BackendVariable.isStateVar(var) then BackendVariable.setStateDerivative(var, NONE()) else var) :: vars;
end for;
vars := MetaModelica.Dangerous.listReverseInPlace(vars);
end removeStateDerInfo;

protected function findSimpleEquations "BB,
Expand Down

0 comments on commit 072f8e9

Please sign in to comment.