Skip to content

Commit f77d426

Browse files
committed
C++: Add test demonstrating broken phi cycle certain'ness.
1 parent c6ce13a commit f77d426

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • cpp/ql/test/library-tests/dataflow/certain

cpp/ql/test/library-tests/dataflow/certain/test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,22 @@ void test3(bool b) { // $ certain="SSA def(&b)" certain="SSA def(b)"
6161
}
6262
use(i); // $ certain="SSA phi(i)"
6363
}
64+
}
65+
66+
void test(int x, bool b1, bool b2) { // $ certain="SSA def(&x)" certain="SSA def(x)" certain="SSA def(&b1)" certain="SSA def(b1)" certain="SSA def(&b2)" certain="SSA def(b2)"
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)"
71+
if (b1) {
72+
*p = 0; // $ certain="SSA def(*p)"
73+
}
74+
++i; // $ certain="SSA def(i)" uncertain="SSA phi(*p)"
75+
}
76+
while (j < 10) { // $ uncertain="SSA phi(*p)" certain="SSA phi(j)"
77+
if (b2) {
78+
*(p + j) = 0; // $ uncertain="SSA def(*p)"
79+
}
80+
++j; // $ certain="SSA def(j)" uncertain="SSA phi(*p)"
81+
}
6482
}

0 commit comments

Comments
 (0)