Skip to content

Commit 42cc9b9

Browse files
author
pkesseli
committed
Fixed type mismatch in generated CEGIS danger_execute calls.
1 parent d8a9db1 commit 42cc9b9

File tree

4 files changed

+6
-39
lines changed

4 files changed

+6
-39
lines changed

src/ansi-c/library/cegis.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#ifndef __CPROVER_CEGIS_H_
2-
#define __CPROVER_CEGIS_H_
3-
#endif
1+
/* FUNCTION: __CPROVER_danger_execute */
42

53
#ifndef __CPROVER_cegis_number_of_vars
64
#define __CPROVER_cegis_number_of_vars 2
@@ -15,8 +13,6 @@
1513
#define __CPROVER_cegis_max_solution_size 1
1614
#endif
1715

18-
/* FUNCTION: __CPROVER_danger_execute */
19-
2016
const void *__CPROVER_cegis_OPS[__CPROVER_cegis_number_of_ops];
2117
void *__CPROVER_cegis_RESULT_OPS[__CPROVER_cegis_max_solution_size];
2218

src/cegis/danger/symex/learn/danger_learn_config.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include <cegis/danger/symex/learn/solution_factory.h>
1717
#include <cegis/danger/symex/learn/danger_learn_config.h>
1818

19-
#include <util/ui_message.h> // XXX: Debug
20-
2119
danger_learn_configt::danger_learn_configt(const danger_programt &program) :
2220
original_program(program), num_consts(0u)
2321
{
@@ -34,8 +32,7 @@ void danger_learn_configt::process(const counterexamplest &ces,
3432
var_ids.clear();
3533
num_consts=get_invariant_variable_ids(program.st, var_ids);
3634
const size_t num_vars=var_ids.size();
37-
//null_message_handlert msg;
38-
ui_message_handlert msg(ui_message_handlert::PLAIN, ""); // XXX: Debug
35+
null_message_handlert msg;
3936
const std::string name(DANGER_EXECUTE);
4037
symbol_tablet &st=program.st;
4138
goto_functionst &gf=program.gf;

src/cegis/instrument/cegis_library.cpp

+2-29
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ void add_execute_placeholder(symbol_tablet &symbol_table,
6161
symbol_table.add(symbol);
6262
}
6363

64-
void set_loop_id(goto_functionst &gf, const std::string &func_name)
65-
{
66-
goto_functionst::function_mapt &fm=gf.function_map;
67-
goto_functionst::function_mapt::iterator execute=fm.find(func_name);
68-
assert(fm.end() != execute);
69-
goto_programt &body=execute->second.body;
70-
goto_programt::instructionst &instrs=body.instructions;
71-
unsigned loop_number=0;
72-
for (goto_programt::targett it=instrs.begin(); it != instrs.end(); ++it)
73-
{
74-
goto_programt::instructiont &instr=*it;
75-
if (instr.is_backwards_goto()) instr.loop_number=loop_number++;
76-
}
77-
}
78-
7964
goto_programt::targett init_array(const symbol_tablet &st, goto_programt &body,
8065
const char * const name, goto_programt::targett pos)
8166
{
@@ -120,22 +105,10 @@ void add_cegis_library(symbol_tablet &st, goto_functionst &gf,
120105
get_cegis_library_text(num_vars, num_consts, max_solution_size,
121106
func_name));
122107

123-
//if(cmdline.isset("gcc"))
124-
/*{
125-
// There are gcc versions that target Windows (MinGW for example),
126-
// and we support that.
127-
config.ansi_c.preprocessor=configt::ansi_ct::preprocessort::PP_GCC;
128-
config.ansi_c.mode=configt::ansi_ct::flavourt::MODE_GCC_C;
129-
130-
// enable Cygwin
131-
#ifdef _WIN32
132-
config.ansi_c.defines.push_back("__CYGWIN__");
133-
#endif
134-
}*/
135-
136108
add_library(library_src, st, msg);
137109
goto_convert(func_name, st, gf, msg);
138-
set_loop_id(gf, func_name);
110+
gf.compute_loop_numbers();
111+
gf.update();
139112
set_init_values(st, gf);
140113
}
141114

src/cegis/invariant/symex/learn/add_invariant_programs_to_learn.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void execute_inv_prog(const symbol_tablet &st, goto_functionst &gf,
4242
const constant_exprt index(from_integer(0u, size_type));
4343
const index_exprt first_elem(prog_symbol, index);
4444
call.arguments().push_back(address_of_exprt(first_elem));
45-
const constant_exprt size(from_integer(max_solution_size, size_type));
45+
const typet size_arg_type(unsigned_char_type());
46+
const constant_exprt size(from_integer(max_solution_size, size_arg_type));
4647
call.arguments().push_back(size);
4748
execution->code=call;
4849
}

0 commit comments

Comments
 (0)