Skip to content

Commit e71dc89

Browse files
author
Your Name
committed
Check update scope
1 parent 2a47ac2 commit e71dc89

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/forwardanalyzer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,11 @@ namespace {
787787
return Break();
788788
} else {
789789
const bool conditional = stopOnCondition(condTok);
790-
ForwardTraversal ft = fork();
790+
// The value only flows into the then-branch when the condition can split
791+
// it. For an opaque or correlated condition (e.g. 'if (f(x))' or
792+
// 'if (do_write)') it does not really reach there, so fork in analyze-only
793+
// mode: the branch's effect is still tracked but nothing is reported in it.
794+
ForwardTraversal ft = fork(!analyzer->updateScope(thenBranch.endBlock, false));
791795
ft.analyzer->assume(condTok, true);
792796
Progress pThen = ft.updateBranch(thenBranch, depth - 1);
793797

0 commit comments

Comments
 (0)