Skip to content

Commit b90c0a5

Browse files
committed
Add regression test for pointer address being found in the trace in new SMT backend.
The difference is that the previous test was effectively exercising NULL and any other pointer value (1, for instance) whereas this one specifically matches the decimal value of 0xDEADBEEF.
1 parent da5addd commit b90c0a5

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int main()
2+
{
3+
int *a;
4+
int *b;
5+
__CPROVER_assume(a == 0xDEADBEEF);
6+
7+
__CPROVER_assert(a != b, "should fail as b can also be assigned 0xDEADBEEF");
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
pointer_values_2.c
3+
--trace --slice-formula
4+
\[main\.assertion\.1\] line \d should fail as b can also be assigned 0xDEADBEEF: FAILURE
5+
a=\(signed int \*\)3735928559
6+
b=\(signed int \*\)3735928559
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
3735928559 is the decimal value of the hex constant 0xDEADBEEF that
12+
the pointer is assumed to point to in this example.

src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class value_expr_from_smt_factoryt : public smt_term_const_downcast_visitort
4444
{
4545
INVARIANT(
4646
pointer_type->get_width() == sort_width,
47-
"Width of smt bit vector term must match the width of pointer type.");
47+
"Width of smt bit vector term must match the width of pointer type.");
4848
if(bit_vector_constant.value() == 0)
4949
{
5050
result = null_pointer_exprt{*pointer_type};

0 commit comments

Comments
 (0)