Skip to content

Commit a59c824

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Fix stack overflow
1 parent 4bed8a9 commit a59c824

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Compiler/Util/Graph.mo

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,15 @@ algorithm
143143

144144
// If the remaining graph is empty we don't need to do much more, just
145145
// append the rest of the start nodes to the result.
146-
case ((node1, {}) :: rest_start, {}, _, _)
147-
equation
148-
(result, _) = topologicalSort2(rest_start, {}, node1 :: inAccumNodes,
149-
inEqualFunc);
150-
then
151-
(result, {});
146+
case (rest_start, {}, _, _)
147+
algorithm
148+
result := inAccumNodes;
149+
for n in rest_start loop
150+
(node1,{}) := n;
151+
result := node1 :: result;
152+
end for;
153+
result := listReverse(result);
154+
then (result, {});
152155

153156
case ((node1, {}) :: rest_start, rest_rest, _, _)
154157
equation

0 commit comments

Comments
 (0)