Skip to content

Commit 6b815d1

Browse files
committed
clean out Java-specific code from goto_check_ct
This removes Java-specific code from goto_check_ct.
1 parent 782090c commit 6b815d1

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
@@ -473,7 +473,7 @@ void goto_check_ct::mod_by_zero_check(
473473
const mod_exprt &expr,
474474
const guardt &guard)
475475
{
476-
if(!enable_div_by_zero_check || mode == ID_java)
476+
if(!enable_div_by_zero_check)
477477
return;
478478

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

@@ -2252,12 +2223,6 @@ void goto_check_ct::goto_check(
22522223
instruction.source_location_nonconst().set_column(
22532224
it->source_location().get_column());
22542225
}
2255-
2256-
if(!it->source_location().get_java_bytecode_index().empty())
2257-
{
2258-
instruction.source_location_nonconst().set_java_bytecode_index(
2259-
it->source_location().get_java_bytecode_index());
2260-
}
22612226
}
22622227
}
22632228

@@ -2288,12 +2253,6 @@ goto_check_ct::get_pointer_points_to_valid_memory_conditions(
22882253

22892254
conditionst conditions;
22902255

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

@@ -2367,24 +2326,17 @@ goto_check_ct::get_pointer_is_null_condition(
23672326
{
23682327
PRECONDITION(local_bitvector_analysis);
23692328
PRECONDITION(address.type().id() == ID_pointer);
2370-
const auto &pointer_type = to_pointer_type(address.type());
23712329
local_bitvector_analysist::flagst flags =
23722330
local_bitvector_analysis->get(current_target, address);
2373-
if(mode == ID_java)
2374-
{
2375-
if(flags.is_unknown() || flags.is_null())
2376-
{
2377-
notequal_exprt not_eq_null(address, null_pointer_exprt{pointer_type});
2378-
return {conditiont{not_eq_null, "reference is null"}};
2379-
}
2380-
}
2381-
else if(flags.is_unknown() || flags.is_uninitialized() || flags.is_null())
2331+
2332+
if(flags.is_unknown() || flags.is_uninitialized() || flags.is_null())
23822333
{
23832334
return {conditiont{
23842335
or_exprt{is_in_bounds_of_some_explicit_allocation(address, size),
23852336
not_exprt(null_pointer(address))},
23862337
"pointer NULL"}};
23872338
}
2339+
23882340
return {};
23892341
}
23902342

0 commit comments

Comments
 (0)