@@ -108,6 +108,11 @@ class java_bytecode_convert_methodt:public messaget
108
108
INST_INDEX_CONST=3
109
109
} instruction_sizet;
110
110
111
+ codet get_array_bounds_check (
112
+ const exprt &arraystruct,
113
+ const exprt &idx,
114
+ const source_locationt& original_sloc);
115
+
111
116
// return corresponding reference of variable
112
117
const variablet &find_variable_for_slot (
113
118
size_t address,
@@ -672,7 +677,7 @@ static member_exprt to_member(const exprt &pointer, const exprt &fieldref)
672
677
fieldref.type ());
673
678
}
674
679
675
- codet get_array_bounds_check (
680
+ codet java_bytecode_convert_methodt:: get_array_bounds_check (
676
681
const exprt &arraystruct,
677
682
const exprt &idx,
678
683
const source_locationt& original_sloc)
@@ -681,22 +686,24 @@ codet get_array_bounds_check(
681
686
binary_relation_exprt gezero (idx, ID_ge, intzero);
682
687
const member_exprt length_field (arraystruct, " length" , java_int_type ());
683
688
binary_relation_exprt ltlength (idx, ID_lt, length_field);
684
- code_blockt boundschecks;
685
- boundschecks.add (code_assertt (gezero));
686
- boundschecks.operands ().back ().add_source_location ()=original_sloc;
687
- boundschecks.operands ().back ().add_source_location ()
689
+ code_blockt bounds_checks;
690
+
691
+ bounds_checks.add (code_assertt (gezero));
692
+ bounds_checks.operands ().back ().add_source_location ()=original_sloc;
693
+ bounds_checks.operands ().back ().add_source_location ()
688
694
.set_comment (" Array index < 0" );
689
- boundschecks .operands ().back ().add_source_location ()
695
+ bounds_checks .operands ().back ().add_source_location ()
690
696
.set_property_class (" array-index-oob-low" );
691
- boundschecks.add (code_assertt (ltlength));
692
- boundschecks.operands ().back ().add_source_location ()=original_sloc;
693
- boundschecks.operands ().back ().add_source_location ()
697
+ bounds_checks.add (code_assertt (ltlength));
698
+
699
+ bounds_checks.operands ().back ().add_source_location ()=original_sloc;
700
+ bounds_checks.operands ().back ().add_source_location ()
694
701
.set_comment (" Array index >= length" );
695
- boundschecks .operands ().back ().add_source_location ()
702
+ bounds_checks .operands ().back ().add_source_location ()
696
703
.set_property_class (" array-index-oob-high" );
697
704
698
705
// TODO make this throw ArrayIndexOutOfBoundsException instead of asserting.
699
- return boundschecks ;
706
+ return bounds_checks ;
700
707
}
701
708
702
709
/* ******************************************************************\
@@ -1235,7 +1242,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1235
1242
{
1236
1243
// Remember that this is triggered by an assertion
1237
1244
if (statement==" invokespecial" &&
1238
- as_string (arg0.get (ID_identifier))
1245
+ id2string (arg0.get (ID_identifier))
1239
1246
.find (" AssertionError" )!=std::string::npos)
1240
1247
{
1241
1248
assertion_failure=true ;
0 commit comments