Skip to content

Commit 91aebe6

Browse files
author
Daniel Kroening
committed
fx
1 parent 9037681 commit 91aebe6

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

src/analyses/goto_check.cpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ class goto_checkt
113113
const exprt &access_ub);
114114
conditionst address_check(
115115
const exprt &address,
116-
const exprt &size);
116+
const exprt &access_lb,
117+
const exprt &access_ub);
117118
void integer_overflow_check(const exprt &expr, const guardt &guard);
118119
void conversion_check(const exprt &expr, const guardt &guard);
119120
void float_overflow_check(const exprt &expr, const guardt &guard);
@@ -1098,7 +1099,8 @@ void goto_checkt::pointer_validity_check(
10981099

10991100
goto_checkt::conditionst goto_checkt::address_check(
11001101
const exprt &address,
1101-
const exprt &size)
1102+
const exprt &access_lb,
1103+
const exprt &access_ub)
11021104
{
11031105
if(!enable_pointer_check)
11041106
return {};
@@ -1130,7 +1132,6 @@ goto_checkt::conditionst goto_checkt::address_check(
11301132
{
11311133
typecast_exprt int_ptr(address, a.first.type());
11321134

1133-
#if 0
11341135
exprt lb(int_ptr);
11351136
if(access_lb.is_not_nil())
11361137
{
@@ -1155,7 +1156,6 @@ goto_checkt::conditionst goto_checkt::address_check(
11551156
ub, ID_le, plus_exprt(a.first, a.second));
11561157

11571158
alloc_disjuncts.push_back(and_exprt(lb_check, ub_check));
1158-
#endif
11591159
}
11601160

11611161
const exprt allocs=disjunction(alloc_disjuncts);
@@ -1187,42 +1187,30 @@ goto_checkt::conditionst goto_checkt::address_check(
11871187

11881188
if(flags.is_unknown() || flags.is_dynamic_heap())
11891189
{
1190-
#if 0
11911190
const or_exprt dynamic_bounds(
11921191
dynamic_object_lower_bound(address, ns, access_lb),
11931192
dynamic_object_upper_bound(address, dereference_type, ns, access_ub));
11941193

1195-
add_guarded_claim(
1194+
conditions.push_back(conditiont(
11961195
or_exprt(
11971196
allocs,
11981197
implies_exprt(
11991198
malloc_object(address, ns),
12001199
not_exprt(dynamic_bounds))),
1201-
"dereference failure: pointer outside dynamic object bounds",
1202-
"pointer dereference",
1203-
expr.find_source_location(),
1204-
expr,
1205-
guard);
1206-
#endif
1200+
"pointer outside dynamic object bounds"));
12071201
}
12081202

12091203
if(flags.is_unknown() ||
12101204
flags.is_dynamic_local() ||
12111205
flags.is_static_lifetime())
12121206
{
1213-
#if 0
12141207
const or_exprt object_bounds(
12151208
object_lower_bound(address, ns, access_lb),
12161209
object_upper_bound(address, dereference_type, ns, access_ub));
12171210

1218-
add_guarded_claim(
1211+
conditions.push_back(conditiont(
12191212
or_exprt(allocs, dynamic_object(address), not_exprt(object_bounds)),
1220-
"dereference failure: pointer outside object bounds",
1221-
"pointer dereference",
1222-
expr.find_source_location(),
1223-
expr,
1224-
guard);
1225-
#endif
1213+
"dereference failure: pointer outside object bounds"));
12261214
}
12271215

12281216
return conditions;
@@ -1659,7 +1647,7 @@ void goto_checkt::rw_ok_check(exprt &expr)
16591647
DATA_INVARIANT(expr.operands().size()==2,
16601648
"r/w_ok must have two operands");
16611649

1662-
const auto conditions=address_check(expr.op0(), expr.op1());
1650+
const auto conditions=address_check(expr.op0(), nil_exprt(), expr.op1());
16631651
exprt::operandst conjuncts;
16641652
for(const auto &c : conditions)
16651653
conjuncts.push_back(c.assertion);

0 commit comments

Comments
 (0)