Skip to content

Commit 46cccb6

Browse files
author
Daniel Kroening
committed
symex must not rename mathematical functions
"mathematical functions" are immutable, and thus, there's no need to give them new identifiers in an SSA.
1 parent b54448c commit 46cccb6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/goto-symex/build_goto_trace.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static void set_internal_dynamic_object(
111111
{
112112
if(expr.id()==ID_symbol)
113113
{
114-
if(expr.type().id() != ID_code)
114+
const auto &type = expr.type();
115+
if(type.id() != ID_code && type.id() != ID_mathematical_function)
115116
{
116117
const irep_idt &id = to_ssa_expr(expr).get_original_name();
117118
const symbolt *symbol;

src/goto-symex/goto_symex_state.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ static bool check_renaming_l1(const exprt &expr)
6464

6565
if(expr.id()==ID_symbol)
6666
{
67+
const auto &type = expr.type();
6768
if(!expr.get_bool(ID_C_SSA_symbol))
68-
return expr.type().id()!=ID_code;
69+
return type.id() != ID_code && type.id() != ID_mathematical_function;
6970
if(!to_ssa_expr(expr).get_level_2().empty())
7071
return true;
71-
if(to_ssa_expr(expr).get_original_expr().type()!=expr.type())
72+
if(to_ssa_expr(expr).get_original_expr().type() != type)
7273
return true;
7374
}
7475
else
@@ -102,11 +103,12 @@ static bool check_renaming(const exprt &expr)
102103
}
103104
else if(expr.id()==ID_symbol)
104105
{
106+
const auto &type = expr.type();
105107
if(!expr.get_bool(ID_C_SSA_symbol))
106-
return expr.type().id()!=ID_code;
108+
return type.id() != ID_code && type.id() != ID_mathematical_function;
107109
if(to_ssa_expr(expr).get_level_2().empty())
108110
return true;
109-
if(to_ssa_expr(expr).get_original_expr().type()!=expr.type())
111+
if(to_ssa_expr(expr).get_original_expr().type() != type)
110112
return true;
111113
}
112114
else
@@ -337,8 +339,10 @@ exprt goto_symex_statet::rename(exprt expr, const namespacet &ns)
337339
}
338340
else if(expr.id()==ID_symbol)
339341
{
342+
const auto &type = as_const(expr).type();
343+
340344
// we never rename function symbols
341-
if(as_const(expr).type().id() == ID_code)
345+
if(type.id() == ID_code || type.id() == ID_mathematical_function)
342346
rename<level>(expr.type(), to_symbol_expr(expr).get_identifier(), ns);
343347
else
344348
expr = rename<level>(ssa_exprt{expr}, ns);

0 commit comments

Comments
 (0)