Skip to content

Commit d65c655

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2484 from tautschnig/vs-printf
printf does not and should not have a left-hand side
2 parents 2111f7c + 6e4d5a7 commit d65c655

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/goto-symex/goto_symex.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ class goto_symext
455455
virtual void symex_fkt(statet &, const code_function_callt &);
456456
virtual void symex_macro(statet &, const code_function_callt &);
457457
virtual void symex_trace(statet &, const code_function_callt &);
458-
virtual void symex_printf(statet &, const exprt &lhs, const exprt &rhs);
458+
virtual void symex_printf(statet &, const exprt &rhs);
459459
virtual void symex_input(statet &, const codet &);
460460
virtual void symex_output(statet &, const codet &);
461461

src/goto-symex/symex_assign.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ void goto_symext::symex_assign(
5454
else if(statement==ID_allocate)
5555
symex_allocate(state, lhs, side_effect_expr);
5656
else if(statement==ID_printf)
57-
symex_printf(state, lhs, side_effect_expr);
57+
{
58+
if(lhs.is_not_nil())
59+
throw "printf: unexpected assignment";
60+
symex_printf(state, side_effect_expr);
61+
}
5862
else if(statement==ID_gcc_builtin_va_arg_next)
5963
symex_gcc_builtin_va_arg_next(state, lhs, side_effect_expr);
6064
else

src/goto-symex/symex_builtin_functions.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ irep_idt get_string_argument(const exprt &src, const namespacet &ns)
311311

312312
void goto_symext::symex_printf(
313313
statet &state,
314-
const exprt &lhs,
315314
const exprt &rhs)
316315
{
317316
if(rhs.operands().empty())

src/goto-symex/symex_other.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void goto_symext::symex_other(
101101
{
102102
codet clean_code=code;
103103
clean_expr(clean_code, state, false);
104-
symex_printf(state, nil_exprt(), clean_code);
104+
symex_printf(state, clean_code);
105105
}
106106
else if(statement==ID_input)
107107
{

0 commit comments

Comments
 (0)