Skip to content

Commit 56d3b33

Browse files
committed
fixup! Value set: lift offset from numeric constants to expressions
Kani's test `tests/kani/Iterator/flat_map.rs` does reach this branch.
1 parent eeb8689 commit 56d3b33

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/pointer-analysis/value_set.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Author: Daniel Kroening, [email protected]
2828
#include <util/symbol.h>
2929
#include <util/xml.h>
3030

31-
#ifdef DEBUG
31+
//#ifdef DEBUG
3232
# include <iostream>
33-
#endif
33+
//#endif
3434

3535
#include "add_failed_symbols.h"
3636

@@ -356,21 +356,6 @@ bool value_sett::eval_pointer_offset(
356356
return false;
357357
else
358358
{
359-
// This branch should not be reached as any constant offset will have
360-
// been used before already. The following code will trigger
361-
// `eval_pointer_offset`, yet we wouldn't end up in this branch:
362-
// struct S { int a; char b; };
363-
//
364-
// int main()
365-
// {
366-
// struct S s;
367-
// int offset;
368-
// __CPROVER_assume(offset >= 0 && offset <= 1 && offset % 2 == 0);
369-
// int *p = (char*)&s + offset;
370-
// int x = *p;
371-
// __CPROVER_assert(s.a == x, "");
372-
// }
373-
UNREACHABLE;
374359
const exprt &object=object_numbering[it->first];
375360
auto ptr_offset = compute_pointer_offset(object, ns);
376361

@@ -1151,6 +1136,7 @@ void value_sett::get_value_set_rec(
11511136
byte_extract_expr.op().type().id() == ID_struct_tag)
11521137
{
11531138
exprt offset = byte_extract_expr.offset();
1139+
std::cerr << "EXPR: " << format(expr) << std::endl;
11541140
if(eval_pointer_offset(offset, ns))
11551141
simplify(offset, ns);
11561142

0 commit comments

Comments
 (0)