We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f77d426 commit f5113b1Copy full SHA for f5113b1
2 files changed
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll
@@ -1379,15 +1379,11 @@ class PhiNode extends Definition instanceof SsaImpl::PhiNode {
1379
1380
private PhiNode getAnInput(PhiNode phi) { result = phi.getAnInput() }
1381
1382
-private predicate definitionCycle(PhiNode phi) { getAnInput+(phi) = phi }
1383
-
1384
-private predicate hasAnInput(PhiNode phi1, PhiNode phi2) {
1385
- definitionCycle(phi1) and
1386
- definitionCycle(phi2) and
1387
- getAnInput(phi1) = phi2
+private predicate sccEdge(PhiNode phi1, PhiNode phi2) {
+ getAnInput(phi1) = phi2 and getAnInput+(phi2) = phi1
1388
}
1389
1390
-private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, hasAnInput/2>;
+private module PhiCycleEquivalence = QlBuiltins::EquivalenceRelation<PhiNode, sccEdge/2>;
1391
1392
private PhiCycle getCycle(PhiNode phi) { result.getAPhiNode() = phi }
1393
cpp/ql/test/library-tests/dataflow/certain/test.cpp
@@ -67,11 +67,11 @@ void test(int x, bool b1, bool b2) { // $ certain="SSA def(&x)" certain="SSA def
67
int* p = &x; // $ certain="SSA def(&p)" certain="SSA def(p)" certain="SSA def(*p)"
68
int i = 0; // $ certain="SSA def(&i)" certain="SSA def(i)"
69
int j = 0; // $ certain="SSA def(&j)" certain="SSA def(j)"
70
- while (i < 10) { // $ certain="SSA phi(i)" uncertain="SSA phi(*p)"
+ while (i < 10) { // $ certain="SSA phi(i)" certain="SSA phi(*p)"
71
if (b1) {
72
*p = 0; // $ certain="SSA def(*p)"
73
74
- ++i; // $ certain="SSA def(i)" uncertain="SSA phi(*p)"
+ ++i; // $ certain="SSA def(i)" certain="SSA phi(*p)"
75
76
while (j < 10) { // $ uncertain="SSA phi(*p)" certain="SSA phi(j)"
77
if (b2) {
0 commit comments