Skip to content

Commit 6369cec

Browse files
committed
clean out Java-specific code from goto_check_ct
This removes Java-specific code from goto_check_ct.
1 parent c700697 commit 6369cec

File tree

1 file changed

+4
-52
lines changed

1 file changed

+4
-52
lines changed

src/analyses/goto_check_c.cpp

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ void goto_check_ct::mod_by_zero_check(
471471
const mod_exprt &expr,
472472
const guardt &guard)
473473
{
474-
if(!enable_div_by_zero_check || mode == ID_java)
474+
if(!enable_div_by_zero_check)
475475
return;
476476

477477
// add divison by zero subgoal
@@ -2052,35 +2052,6 @@ void goto_check_ct::goto_check(
20522052
}
20532053
else if(i.is_function_call())
20542054
{
2055-
const auto &function = i.call_function();
2056-
2057-
// for Java, need to check whether 'this' is null
2058-
// on non-static method invocations
2059-
if(
2060-
mode == ID_java && enable_pointer_check &&
2061-
!i.call_arguments().empty() && function.type().id() == ID_code &&
2062-
to_code_type(function.type()).has_this())
2063-
{
2064-
exprt pointer = i.call_arguments()[0];
2065-
2066-
local_bitvector_analysist::flagst flags =
2067-
local_bitvector_analysis->get(current_target, pointer);
2068-
2069-
if(flags.is_unknown() || flags.is_null())
2070-
{
2071-
notequal_exprt not_eq_null(
2072-
pointer, null_pointer_exprt(to_pointer_type(pointer.type())));
2073-
2074-
add_guarded_property(
2075-
not_eq_null,
2076-
"this is null on method invocation",
2077-
"pointer dereference",
2078-
i.source_location(),
2079-
pointer,
2080-
guardt(true_exprt(), guard_manager));
2081-
}
2082-
}
2083-
20842055
check(i.call_lhs());
20852056
check(i.call_function());
20862057

@@ -2250,12 +2221,6 @@ void goto_check_ct::goto_check(
22502221
instruction.source_location_nonconst().set_column(
22512222
it->source_location().get_column());
22522223
}
2253-
2254-
if(!it->source_location().get_java_bytecode_index().empty())
2255-
{
2256-
instruction.source_location_nonconst().set_java_bytecode_index(
2257-
it->source_location().get_java_bytecode_index());
2258-
}
22592224
}
22602225
}
22612226

@@ -2286,12 +2251,6 @@ goto_check_ct::get_pointer_points_to_valid_memory_conditions(
22862251

22872252
conditionst conditions;
22882253

2289-
if(mode == ID_java)
2290-
{
2291-
// The following conditions don’t apply to Java
2292-
return conditions;
2293-
}
2294-
22952254
const exprt in_bounds_of_some_explicit_allocation =
22962255
is_in_bounds_of_some_explicit_allocation(address, size);
22972256

@@ -2365,24 +2324,17 @@ goto_check_ct::get_pointer_is_null_condition(
23652324
{
23662325
PRECONDITION(local_bitvector_analysis);
23672326
PRECONDITION(address.type().id() == ID_pointer);
2368-
const auto &pointer_type = to_pointer_type(address.type());
23692327
local_bitvector_analysist::flagst flags =
23702328
local_bitvector_analysis->get(current_target, address);
2371-
if(mode == ID_java)
2372-
{
2373-
if(flags.is_unknown() || flags.is_null())
2374-
{
2375-
notequal_exprt not_eq_null(address, null_pointer_exprt{pointer_type});
2376-
return {conditiont{not_eq_null, "reference is null"}};
2377-
}
2378-
}
2379-
else if(flags.is_unknown() || flags.is_uninitialized() || flags.is_null())
2329+
2330+
if(flags.is_unknown() || flags.is_uninitialized() || flags.is_null())
23802331
{
23812332
return {conditiont{
23822333
or_exprt{is_in_bounds_of_some_explicit_allocation(address, size),
23832334
not_exprt(null_pointer(address))},
23842335
"pointer NULL"}};
23852336
}
2337+
23862338
return {};
23872339
}
23882340

0 commit comments

Comments
 (0)