Skip to content

Commit 51b3944

Browse files
authored
Merge pull request #6119 from tautschnig/concurrency-spawn
Concurrency: do not lose L2 entries of procedure-local variables
2 parents e59bbcd + 2c02dab commit 51b3944

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
void foo(unsigned x)
2+
{
3+
__CPROVER_assert(x <= 1, "");
4+
}
5+
6+
int main()
7+
{
8+
unsigned local_to_main;
9+
local_to_main %= 2;
10+
_Bool nondet1;
11+
if(nondet1)
12+
{
13+
__CPROVER_ASYNC_1:
14+
foo(local_to_main);
15+
return 0;
16+
}
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--
10+
Procedure-local variables must be copied into a newly created thread, and must
11+
not be lost when merging goto states.

src/goto-symex/symex_goto.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,12 @@ static void merge_names(
784784
// only later be removed from level2.current_names by pop_frame
785785
// once the thread is executed)
786786
const irep_idt level_0 = ssa.get_level_0();
787-
if(!level_0.empty() && level_0 != std::to_string(dest_state.source.thread_nr))
787+
if(
788+
!level_0.empty() &&
789+
level_0 != std::to_string(dest_state.source.thread_nr) && dest_count != 0)
790+
{
788791
return;
792+
}
789793

790794
exprt goto_state_rhs = ssa, dest_state_rhs = ssa;
791795

0 commit comments

Comments
 (0)