Skip to content

Commit 2a47ac2

Browse files
author
Your Name
committed
Check known condition
1 parent 63b81ea commit 2a47ac2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/forwardanalyzer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,14 @@ namespace {
773773
if (thenBranch.check) {
774774
// The condition is only "known" because of an earlier assumption, so the
775775
// skipped else block could still modify the value -> lower to possible
776-
if (analyzer->isConditional() && hasElse && analyzeScope(elseBranch.endBlock).isModified() &&
776+
if (!condTok->hasKnownIntValue() && hasElse && analyzeScope(elseBranch.endBlock).isModified() &&
777777
!analyzer->lowerToPossible())
778778
return Break(Analyzer::Terminate::Bail);
779779
if (updateScope(thenBranch.endBlock, depth - 1) == Progress::Break)
780780
return Break();
781781
} else if (elseBranch.check) {
782782
// Likewise the skipped then block could still modify the value
783-
if (analyzer->isConditional() && analyzeScope(thenBranch.endBlock).isModified() &&
783+
if (!condTok->hasKnownIntValue() && analyzeScope(thenBranch.endBlock).isModified() &&
784784
!analyzer->lowerToPossible())
785785
return Break(Analyzer::Terminate::Bail);
786786
if (elseBranch.endBlock && updateScope(elseBranch.endBlock, depth - 1) == Progress::Break)

0 commit comments

Comments
 (0)