Skip to content

Commit d6f02c0

Browse files
committed
Small fixes
will be squashed.
1 parent 1abe151 commit d6f02c0

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

regression/cbmc/string-refinement-strchr1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
test.c
33
--refine-strings --max-nondet-string-length 10
44
^EXIT=10$

regression/cbmc/string-refinement-strchr2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
test.c
33
--refine-strings
44
^EXIT=10$

src/goto-programs/string_instrumentation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void string_instrumentation(
201201
message_handlert &message_handler,
202202
const std::string &maybe_max_nondet_string_length_string)
203203
{
204-
size_t max_nondet_string_length = 1000; //default
204+
size_t max_nondet_string_length = 1000; // default
205205
if(!maybe_max_nondet_string_length_string.empty())
206206
{
207207
auto maybe_max_nondet_string_length =

src/solvers/strings/string_constraint_generator_indexof.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ string_constraint_generatort::add_axioms_for_c_index_of(
128128
constraints.existential.push_back(a2);
129129

130130
const exprt lower_bound(zero_if_negative(from_index));
131-
// make sure that terminating zero exists (and is the smallest index after from
132-
// that has a 0 character)
131+
// make sure that terminating zero exists (and is the smallest index after
132+
// from that has a 0 character)
133133
constraints.existential.push_back(
134134
equal_exprt{str[terminating_zero], from_integer(0, c.type())});
135135
symbol_exprt k = fresh_symbol("QA_index_of", index_type);

src/util/pointer_offset_size.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,17 @@ optionalt<exprt> get_subexpression_at_offset(
632632
return typecast_exprt(expr, target_type_raw);
633633
}
634634

635+
if(
636+
offset_bytes == 0 && expr.type().id() == ID_pointer &&
637+
target_type_raw.id() == ID_array)
638+
{
639+
// subexpression at offset zero is the whole thing even for arrays
640+
return byte_extract_exprt{byte_extract_id(),
641+
expr,
642+
from_integer(offset_bytes, index_type()),
643+
target_type_raw};
644+
}
645+
635646
const typet &source_type = ns.follow(expr.type());
636647
const auto target_size_bits = pointer_offset_bits(target_type_raw, ns);
637648
if(!target_size_bits.has_value())

0 commit comments

Comments
 (0)