Skip to content

Commit 28a921e

Browse files
authored
Fix/iterative update (#2206)
* use iterative algo to prevent exceeding recursion limit * proper fixpoint
1 parent b292175 commit 28a921e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

slither/solc_parsing/declarations/function.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,11 +1106,13 @@ def _parse_unchecked_block(self, block: Dict, node: NodeSolc, scope):
11061106
return node
11071107

11081108
def _update_reachability(self, node: Node) -> None:
1109-
if node.is_reachable:
1110-
return
1111-
node.set_is_reachable(True)
1112-
for son in node.sons:
1113-
self._update_reachability(son)
1109+
worklist = [node]
1110+
while worklist:
1111+
current = worklist.pop()
1112+
# fix point
1113+
if not current.is_reachable:
1114+
current.set_is_reachable(True)
1115+
worklist.extend(current.sons)
11141116

11151117
def _parse_cfg(self, cfg: Dict) -> None:
11161118

0 commit comments

Comments
 (0)