Skip to content

Prevent anonymous and named variables from clashing #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class java_bytecode_convert_methodt:public messaget
if(var.symbol_expr.get_identifier().empty())
{
// an un-named local variable
irep_idt base_name="local"+id2string(number)+type_char;
irep_idt base_name="anonlocal::"+id2string(number)+type_char;
irep_idt identifier=id2string(current_method)+"::"+id2string(base_name);

symbol_exprt result(identifier, t);
Expand Down Expand Up @@ -304,7 +304,9 @@ void java_bytecode_convert_methodt::convert(
for(const auto & v : m.local_variable_table)
{
typet t=java_type_from_string(v.signature);
irep_idt identifier=id2string(method_identifier)+"::"+id2string(v.name);
std::ostringstream id_oss;
id_oss << method_identifier << "::" << v.start_pc << "::" << v.name;
irep_idt identifier(id_oss.str());
symbol_exprt result(identifier, t);
result.set(ID_C_base_name, v.name);
size_t number_index_entries = variables[v.index].size();
Expand Down