Skip to content

Disable CPROVER_memory references for Java #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/cbmc/bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Author: Daniel Kroening, [email protected]
#include <util/time_stopping.h>
#include <util/message.h>
#include <util/json.h>
#include <util/cprover_prefix.h>

#include <langapi/mode.h>
#include <langapi/languages.h>
Expand Down Expand Up @@ -410,6 +411,12 @@ safety_checkert::resultt bmct::run(
symex.set_message_handler(get_message_handler());
symex.options=options;

{
const symbolt *init_symbol;
if(!ns.lookup(CPROVER_PREFIX "initialize", init_symbol))
symex.mode=init_symbol->mode;
}

status() << "Starting Bounded Model Checking" << eom;

symex.last_source_location.make_nil();
Expand Down
5 changes: 4 additions & 1 deletion src/goto-symex/goto_symex.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class goto_symext
remaining_vccs(0),
constant_propagation(true),
new_symbol_table(_new_symbol_table),
mode(),
ns(_ns),
target(_target),
atomic_section_counter(0),
Expand Down Expand Up @@ -95,9 +96,11 @@ class goto_symext
optionst options;
symbol_tablet &new_symbol_table;

irep_idt mode;

protected:
const namespacet &ns;
symex_targett &target;
symex_targett &target;
unsigned atomic_section_counter;

friend class symex_dereference_statet;
Expand Down
3 changes: 2 additions & 1 deletion src/goto-symex/symex_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ void goto_symext::dereference_rec(
ns,
new_symbol_table,
options,
symex_dereference_state);
symex_dereference_state,
mode);

// std::cout << "**** " << from_expr(ns, "", tmp1) << std::endl;
exprt tmp2=dereference.dereference(
Expand Down
6 changes: 6 additions & 0 deletions src/pointer-analysis/value_set_dereference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ value_set_dereferencet::valuet value_set_dereferencet::build_reference_to(
// This is stuff like *((char *)5).
// This is turned into an access to __CPROVER_memory[...].

if(language_mode==ID_java)
{
result.value=nil_exprt();
return result;
}

const symbolt &memory_symbol=ns.lookup(CPROVER_PREFIX "memory");
exprt symbol_expr=symbol_exprt(memory_symbol.name, memory_symbol.type);

Expand Down
7 changes: 5 additions & 2 deletions src/pointer-analysis/value_set_dereference.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ class value_set_dereferencet
const namespacet &_ns,
symbol_tablet &_new_symbol_table,
const optionst &_options,
dereference_callbackt &_dereference_callback):
dereference_callbackt &_dereference_callback,
const irep_idt _language_mode = irep_idt()):
ns(_ns),
new_symbol_table(_new_symbol_table),
options(_options),
dereference_callback(_dereference_callback)
dereference_callback(_dereference_callback),
language_mode(_language_mode)
{ }

virtual ~value_set_dereferencet() { }
Expand Down Expand Up @@ -80,6 +82,7 @@ class value_set_dereferencet
symbol_tablet &new_symbol_table;
const optionst &options;
dereference_callbackt &dereference_callback;
const irep_idt language_mode;
static unsigned invalid_counter;

bool dereference_type_compare(
Expand Down