Skip to content

Commit 6456ee0

Browse files
committed
Implement strchr in terms of index-of
by 1: associating the `src` with a new infinite array, 2: associating the array with its length variable, 3: applying the c_index_of function 4: translating the returned index to the expected char-pointer/NULL.
1 parent 55aec9d commit 6456ee0

File tree

3 files changed

+303
-22
lines changed

3 files changed

+303
-22
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
362362
{
363363
options.set_option("refine-strings", true);
364364
options.set_option("string-printable", cmdline.isset("string-printable"));
365+
options.set_option(
366+
"max-nondet-string-length",
367+
cmdline.get_value("max-nondet-string-length"));
365368
}
366369

367370
if(cmdline.isset("max-node-refinement"))
@@ -830,8 +833,13 @@ bool cbmc_parse_optionst::process_goto_program(
830833
link_to_library(
831834
goto_model, log.get_message_handler(), cprover_c_library_factory);
832835

833-
if(options.get_bool_option("string-abstraction"))
834-
string_instrumentation(goto_model, log.get_message_handler());
836+
if(
837+
options.get_bool_option("string-abstraction") ||
838+
options.get_bool_option("refine-strings"))
839+
string_instrumentation(
840+
goto_model,
841+
log.get_message_handler(),
842+
options.get_option("max-nondet-string-length"));
835843

836844
// remove function pointers
837845
log.status() << "Removal of function pointers and virtual functions"

0 commit comments

Comments
 (0)