Skip to content

Commit e96e09b

Browse files
peterschrammelmartin
authored and
martin
committed
Regression test for constant propagator merge bug
1 parent ba55a2f commit e96e09b

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
3+
void main()
4+
{
5+
unsigned char n;
6+
__CPROVER_assume(n > 0); // To keep division well defined
7+
__CPROVER_assume(n * n > 0); // To keep division well defined
8+
9+
unsigned char i = 0;
10+
unsigned char j = 0;
11+
12+
unsigned char aux1 = i / (n * n);
13+
for (i = 0; i < n; ++i, aux1 = i / (n * n)) {
14+
for (j = 0; j < n; ++j) {
15+
}
16+
}
17+
assert(i != n);
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--constant-propagator --unwind 3
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring

src/analyses/constant_propagator.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ void constant_propagator_domaint::transform(
6666
dynamic_cast<constant_propagator_ait *>(&ai);
6767
bool have_dirty=(cp!=nullptr);
6868

69-
// INVARIANT(!values.is_bottom);
69+
// Transform on a domain that is bottom is possible
70+
// if a branch is impossible the target can still wind
71+
// up on the work list.
7072
if(values.is_bottom)
7173
return;
7274

0 commit comments

Comments
 (0)