Skip to content

Commit 05652d2

Browse files
author
Daniel Kroening
authored
Merge pull request #384 from smowton/namespace_anonymous_locals_vsmaster
Prevent anonymous and named variables from clashing
2 parents dbabd39 + 73679c8 commit 05652d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class java_bytecode_convert_methodt:public messaget
134134
if(var.symbol_expr.get_identifier().empty())
135135
{
136136
// an un-named local variable
137-
irep_idt base_name="local"+id2string(number)+type_char;
137+
irep_idt base_name="anonlocal::"+id2string(number)+type_char;
138138
irep_idt identifier=id2string(current_method)+"::"+id2string(base_name);
139139

140140
symbol_exprt result(identifier, t);
@@ -304,7 +304,9 @@ void java_bytecode_convert_methodt::convert(
304304
for(const auto & v : m.local_variable_table)
305305
{
306306
typet t=java_type_from_string(v.signature);
307-
irep_idt identifier=id2string(method_identifier)+"::"+id2string(v.name);
307+
std::ostringstream id_oss;
308+
id_oss << method_identifier << "::" << v.start_pc << "::" << v.name;
309+
irep_idt identifier(id_oss.str());
308310
symbol_exprt result(identifier, t);
309311
result.set(ID_C_base_name, v.name);
310312
size_t number_index_entries = variables[v.index].size();

0 commit comments

Comments
 (0)