Skip to content
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

goto-symex: move level1 map to goto_statet #8439

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions regression/cbmc/Local_out_of_scope5/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
int main()
{
int jumpguard;
jumpguard = jumpguard | 1;
label_1:
while(1)
{
int canary = 1;
if(jumpguard == 0)
{
goto label_1;
}
__CPROVER_assert(canary, "should pass");
break;
}
}
8 changes: 8 additions & 0 deletions regression/cbmc/Local_out_of_scope5/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
2 changes: 2 additions & 0 deletions src/goto-symex/goto_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class goto_statet
symex_level2t level2;

public:
symex_level1t level1;

/// This is used for eliminating repeated complicated dereferences.
/// \see goto_symext::dereference_rec
sharing_mapt<exprt, symbol_exprt, false, irep_hash> dereference_cache;
Expand Down
3 changes: 1 addition & 2 deletions src/goto-symex/goto_symex_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class goto_symex_statet final : public goto_statet
guard_managert &guard_manager;
symex_target_equationt *symex_target;

symex_level1t level1;

/// Rewrites symbol expressions in \ref exprt, applying a suffix to each
/// symbol reflecting its most recent version, which differs depending on
/// which level you requested. Each level also updates its predecessors, so
Expand Down Expand Up @@ -188,6 +186,7 @@ class goto_symex_statet final : public goto_statet
irep_idt function_id;
guardt guard;
call_stackt call_stack;
symex_level1t level1;
std::map<irep_idt, unsigned> function_frame;
unsigned atomic_section_id = 0;
explicit threadt(guard_managert &guard_manager)
Expand Down
2 changes: 2 additions & 0 deletions src/goto-symex/symex_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ switch_to_thread(goto_symex_statet &state, const unsigned int thread_nb)
state.source.pc = state.threads[thread_nb].pc;
state.source.function_id = state.threads[thread_nb].function_id;

state.level1.restore_from(state.threads[thread_nb].level1);

state.guard = state.threads[thread_nb].guard;
// A thread's initial state is certainly reachable:
state.reachable = true;
Expand Down
4 changes: 4 additions & 0 deletions src/goto-symex/symex_start_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ void goto_symext::symex_start_thread(statet &state)
}
}

// retain the current set of objects so as to restore when symbolically
// executing the thread
new_thread.level1 = state.level1;

// initialize all variables marked thread-local
const symbol_tablet &symbol_table=ns.get_symbol_table();

Expand Down
Loading