Skip to content

Commit e730633

Browse files
committed
Remove ID_C_bounds_check special-case in goto_check_{c,java}t
This is never used in the Java front-end, and the C front-end can safely use the pragma-based approach that is more general.
1 parent 79c1637 commit e730633

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

jbmc/src/java_bytecode/goto_check_java.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -927,13 +927,6 @@ void goto_check_javat::bounds_check(const exprt &expr)
927927
if(!enable_bounds_check)
928928
return;
929929

930-
if(
931-
expr.find(ID_C_bounds_check).is_not_nil() &&
932-
!expr.get_bool(ID_C_bounds_check))
933-
{
934-
return;
935-
}
936-
937930
if(expr.id() == ID_index)
938931
bounds_check_index(to_index_expr(expr));
939932
}

src/analyses/goto_check_c.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,13 +1512,6 @@ void goto_check_ct::bounds_check(const exprt &expr, const guardt &guard)
15121512
if(!enable_bounds_check)
15131513
return;
15141514

1515-
if(
1516-
expr.find(ID_C_bounds_check).is_not_nil() &&
1517-
!expr.get_bool(ID_C_bounds_check))
1518-
{
1519-
return;
1520-
}
1521-
15221515
if(expr.id() == ID_index)
15231516
bounds_check_index(to_index_expr(expr), guard);
15241517
else if(

src/ansi-c/ansi_c_entry_point.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ bool generate_ansi_c_start_function(
410410
index_exprt index_expr(
411411
argv_symbol.symbol_expr(), argc_symbol.symbol_expr());
412412

413-
// disable bounds check on that one
414-
index_expr.set(ID_C_bounds_check, false);
415-
416413
init_code.add(code_frontend_assignt(index_expr, null));
414+
// disable bounds check on that one
415+
init_code.statements().back().add_source_location().add_pragma(
416+
"disable:bounds-check");
417417
}
418418

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

428428
index_exprt index_expr(
429429
envp_symbol.symbol_expr(), envp_size_symbol.symbol_expr());
430-
// disable bounds check on that one
431-
index_expr.set(ID_C_bounds_check, false);
432430

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

435433
init_code.add(code_assumet(is_null));
434+
// disable bounds check on that one
435+
init_code.statements().back().add_source_location().add_pragma(
436+
"disable:bounds-check");
436437
}
437438

438439
{
@@ -452,9 +453,8 @@ bool generate_ansi_c_start_function(
452453
{
453454
index_exprt index_expr(
454455
argv_symbol.symbol_expr(), from_integer(0, c_index_type()));
455-
456456
// disable bounds check on that one
457-
index_expr.set(ID_C_bounds_check, false);
457+
index_expr.add_source_location().add_pragma("disable:bounds-check");
458458

459459
const pointer_typet &pointer_type =
460460
to_pointer_type(parameters[1].type());

src/goto-programs/string_abstraction.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,6 @@ void string_abstractiont::abstract_function_call(
568568
"argument array type differs from formal parameter pointer type");
569569

570570
index_exprt idx(str_args.back(), from_integer(0, c_index_type()));
571-
// disable bounds check on that one
572-
idx.set(ID_C_bounds_check, false);
573-
574571
str_args.back()=address_of_exprt(idx);
575572
}
576573

0 commit comments

Comments
 (0)