Skip to content

Commit c2825ef

Browse files
author
Daniel Kroening
authored
Merge pull request #2741 from diffblue/remove_asm_function_id
properly set function id on instructions added by remove_asm
2 parents aa7b89f + ef4bb3c commit c2825ef

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
void func()
2+
{
3+
asm("mfence");
4+
}
5+
6+
int main(void)
7+
{
8+
func();
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--full-slice
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

src/analyses/flow_insensitive_analysis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ bool flow_insensitive_analysis_baset::do_function_call(
240240
// get the state at the beginning of the function
241241
locationt l_begin=goto_function.body.instructions.begin();
242242

243+
DATA_INVARIANT(
244+
l_begin->function == f_it->first, "function names have to match");
245+
243246
// do the edge from the call site to the beginning of the function
244247
new_data=state.transform(ns, l_call, l_begin);
245248

src/goto-programs/remove_asm.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ void remove_asmt::process_function(
467467
it->make_skip();
468468
did_something = true;
469469

470+
for(auto &instruction : tmp_dest.instructions)
471+
instruction.function = it->function;
472+
470473
goto_programt::targett next=it;
471474
next++;
472475

0 commit comments

Comments
 (0)