Skip to content

Commit 3688466

Browse files
authored
Merge pull request github#13592 from rdmarsh2/rdmarsh2/range-analysis-back-edge-2
C++: fix irreducible control flow logic
2 parents 656b4fc + e90153f commit 3688466

File tree

2 files changed

+3
-2
lines changed
  • cpp/ql

2 files changed

+3
-2
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticSSA.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ predicate semBackEdge(SemSsaPhiNode phi, SemSsaVariable inp, SemSsaReadPositionP
7070
// Conservatively assume that every edge is a back edge if we don't have dominance information.
7171
(
7272
phi.getBasicBlock().bbDominates(edge.getOrigBlock()) or
73-
irreducibleSccEdge(phi.getBasicBlock(), edge.getOrigBlock()) or
73+
irreducibleSccEdge(edge.getOrigBlock(), phi.getBasicBlock()) or
7474
not edge.getOrigBlock().hasDominanceInformation()
7575
)
7676
}

cpp/ql/test/library-tests/ir/range-analysis/test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ void gotoLoop(bool b1, bool b2)
9090
{
9191
for (j = 0; j < 10; ++j)
9292
{
93+
int x;
9394
main_decode_loop:
9495
}
9596
}
96-
}
97+
}

0 commit comments

Comments
 (0)