Skip to content

Remove ID_C_bounds_check special-case in goto_check_ct #6684

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
Show file tree
Hide file tree
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
7 changes: 0 additions & 7 deletions src/analyses/goto_check_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,13 +1505,6 @@ void goto_check_ct::bounds_check(const exprt &expr, const guardt &guard)
if(!enable_bounds_check)
return;

if(
expr.find(ID_C_bounds_check).is_not_nil() &&
!expr.get_bool(ID_C_bounds_check))
{
return;
}

if(expr.id() == ID_index)
bounds_check_index(to_index_expr(expr), guard);
else if(
Expand Down
14 changes: 7 additions & 7 deletions src/ansi-c/ansi_c_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ bool generate_ansi_c_start_function(
index_exprt index_expr(
argv_symbol.symbol_expr(), argc_symbol.symbol_expr());

// disable bounds check on that one
index_expr.set(ID_C_bounds_check, false);

init_code.add(code_frontend_assignt(index_expr, null));
// disable bounds check on that one
init_code.statements().back().add_source_location().add_pragma(
"disable:bounds-check");
}

if(parameters.size()==3)
Expand All @@ -427,12 +427,13 @@ bool generate_ansi_c_start_function(

index_exprt index_expr(
envp_symbol.symbol_expr(), envp_size_symbol.symbol_expr());
// disable bounds check on that one
index_expr.set(ID_C_bounds_check, false);

equal_exprt is_null(std::move(index_expr), std::move(null));

init_code.add(code_assumet(is_null));
// disable bounds check on that one
init_code.statements().back().add_source_location().add_pragma(
"disable:bounds-check");
}

{
Expand All @@ -452,9 +453,8 @@ bool generate_ansi_c_start_function(
{
index_exprt index_expr(
argv_symbol.symbol_expr(), from_integer(0, c_index_type()));

// disable bounds check on that one
index_expr.set(ID_C_bounds_check, false);
index_expr.add_source_location().add_pragma("disable:bounds-check");

const pointer_typet &pointer_type =
to_pointer_type(parameters[1].type());
Expand Down
3 changes: 0 additions & 3 deletions src/goto-programs/string_abstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,6 @@ void string_abstractiont::abstract_function_call(
"argument array type differs from formal parameter pointer type");

index_exprt idx(str_args.back(), from_integer(0, c_index_type()));
// disable bounds check on that one
idx.set(ID_C_bounds_check, false);

str_args.back()=address_of_exprt(idx);
}

Expand Down