Skip to content

Commit

Permalink
[Backend] prevent stackoverflow for recursive function differentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Feb 13, 2018
1 parent 815ffe0 commit c15e7bd
Show file tree
Hide file tree
Showing 3 changed files with 287 additions and 268 deletions.
4 changes: 3 additions & 1 deletion Compiler/BackEnd/BackendDAE.mo
Expand Up @@ -36,6 +36,7 @@ encapsulated package BackendDAE
"

import Absyn;
import AvlSetPath;
import DAE;
import DoubleEndedList;
import ExpandableArray;
Expand Down Expand Up @@ -775,10 +776,11 @@ uniontype DifferentiateInputData
list< Var> controlVars; // variables to save control vars of for algorithm
list< .DAE.ComponentRef> diffCrefs; // all crefs to differentiate, needed for generic gradient
Option<String> matrixName; // name to create temporary vars, needed for generic gradient
AvlSetPath.Tree diffedFunctions; // current functions, to prevent recursive differentiation
end DIFFINPUTDATA;
end DifferentiateInputData;

public constant DifferentiateInputData emptyInputData = DIFFINPUTDATA(NONE(),NONE(),NONE(),NONE(),{},{},NONE());
public constant DifferentiateInputData emptyInputData = DIFFINPUTDATA(NONE(),NONE(),NONE(),NONE(),{},{},NONE(),AvlSetPath.EMPTY());

public
type DifferentiateInputArguments = tuple< .DAE.ComponentRef, DifferentiateInputData, DifferentiationType, .DAE.FunctionTree>;
Expand Down

0 comments on commit c15e7bd

Please sign in to comment.