|
25 | 25 | #include <util/arith_tools.h>
|
26 | 26 | #include <util/c_types.h>
|
27 | 27 | #include <util/expr_initializer.h>
|
| 28 | +#include <util/expr_util.h> |
28 | 29 | #include <util/ieee_float.h>
|
29 | 30 | #include <util/invariant.h>
|
30 | 31 | #include <util/namespace.h>
|
@@ -3184,28 +3185,34 @@ void java_bytecode_convert_methodt::save_stack_entries(
|
3184 | 3185 | {
|
3185 | 3186 | for(auto &stack_entry : stack)
|
3186 | 3187 | {
|
| 3188 | + // remove typecasts if existing |
| 3189 | + const auto &entry = skip_typecast(stack_entry); |
| 3190 | + |
3187 | 3191 | // variables or static fields and symbol -> save symbols with same id
|
3188 |
| - if((write_type==bytecode_write_typet::VARIABLE || |
3189 |
| - write_type==bytecode_write_typet::STATIC_FIELD) && |
3190 |
| - stack_entry.id()==ID_symbol) |
| 3192 | + if( |
| 3193 | + (write_type == bytecode_write_typet::VARIABLE || |
| 3194 | + write_type == bytecode_write_typet::STATIC_FIELD) && |
| 3195 | + entry.id() == ID_symbol) |
3191 | 3196 | {
|
3192 |
| - const symbol_exprt &var=to_symbol_expr(stack_entry); |
3193 |
| - if(var.get_identifier()==identifier) |
| 3197 | + if(to_symbol_expr(entry).get_identifier() == identifier) |
3194 | 3198 | create_stack_tmp_var(tmp_var_prefix, tmp_var_type, block, stack_entry);
|
3195 | 3199 | }
|
3196 | 3200 |
|
3197 | 3201 | // array reference and dereference -> save all references on the stack
|
3198 |
| - else if(write_type==bytecode_write_typet::ARRAY_REF && |
3199 |
| - stack_entry.id()==ID_dereference) |
| 3202 | + else if( |
| 3203 | + write_type == bytecode_write_typet::ARRAY_REF && |
| 3204 | + entry.id() == ID_dereference) |
| 3205 | + { |
3200 | 3206 | create_stack_tmp_var(tmp_var_prefix, tmp_var_type, block, stack_entry);
|
| 3207 | + } |
3201 | 3208 |
|
3202 | 3209 | // field and member access -> compare component name
|
3203 |
| - else if(write_type==bytecode_write_typet::FIELD && |
3204 |
| - stack_entry.id()==ID_member) |
| 3210 | + else if( |
| 3211 | + write_type == bytecode_write_typet::FIELD && |
| 3212 | + entry.id() == ID_member) |
3205 | 3213 | {
|
3206 |
| - const irep_idt &entry_id= |
3207 |
| - to_member_expr(stack_entry).get_component_name(); |
3208 |
| - if(entry_id==identifier) |
| 3214 | + const irep_idt &entry_id = to_member_expr(entry).get_component_name(); |
| 3215 | + if(entry_id == identifier) |
3209 | 3216 | create_stack_tmp_var(tmp_var_prefix, tmp_var_type, block, stack_entry);
|
3210 | 3217 | }
|
3211 | 3218 | }
|
|
0 commit comments