@@ -992,12 +992,16 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
992
992
alloc_disjuncts.push_back (and_exprt (lb_check, ub_check));
993
993
}
994
994
995
- const exprt allocs = disjunction (alloc_disjuncts);
995
+ const exprt in_bounds_of_some_explicit_allocation =
996
+ disjunction (alloc_disjuncts);
996
997
997
998
if (flags.is_unknown () || flags.is_null ())
998
999
{
999
1000
conditions.push_back (conditiont (
1000
- or_exprt (allocs, not_exprt (null_pointer (address))), " pointer NULL" ));
1001
+ or_exprt (
1002
+ in_bounds_of_some_explicit_allocation,
1003
+ not_exprt (null_pointer (address))),
1004
+ " pointer NULL" ));
1001
1005
}
1002
1006
1003
1007
if (flags.is_unknown ())
@@ -1010,21 +1014,28 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
1010
1014
if (flags.is_uninitialized ())
1011
1015
{
1012
1016
conditions.push_back (conditiont (
1013
- or_exprt (allocs, not_exprt (invalid_pointer (address))),
1017
+ or_exprt (
1018
+ in_bounds_of_some_explicit_allocation,
1019
+ not_exprt (invalid_pointer (address))),
1014
1020
" pointer uninitialized" ));
1015
1021
}
1016
1022
1017
1023
if (flags.is_unknown () || flags.is_dynamic_heap ())
1018
1024
{
1019
1025
conditions.push_back (conditiont (
1020
- not_exprt (deallocated (address, ns)),
1026
+ or_exprt (
1027
+ in_bounds_of_some_explicit_allocation,
1028
+ not_exprt (deallocated (address, ns))),
1021
1029
" deallocated dynamic object" ));
1022
1030
}
1023
1031
1024
1032
if (flags.is_unknown () || flags.is_dynamic_local ())
1025
1033
{
1026
1034
conditions.push_back (conditiont (
1027
- not_exprt (dead_object (address, ns)), " dead object" ));
1035
+ or_exprt (
1036
+ in_bounds_of_some_explicit_allocation,
1037
+ not_exprt (dead_object (address, ns))),
1038
+ " dead object" ));
1028
1039
}
1029
1040
1030
1041
if (flags.is_unknown () || flags.is_dynamic_heap ())
@@ -1034,7 +1045,10 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
1034
1045
dynamic_object_upper_bound (address, ns, size));
1035
1046
1036
1047
conditions.push_back (conditiont (
1037
- implies_exprt (malloc_object (address, ns), not_exprt (dynamic_bounds_violation)),
1048
+ or_exprt (
1049
+ in_bounds_of_some_explicit_allocation,
1050
+ implies_exprt (
1051
+ malloc_object (address, ns), not_exprt (dynamic_bounds_violation))),
1038
1052
" pointer outside dynamic object bounds" ));
1039
1053
}
1040
1054
@@ -1047,14 +1061,19 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
1047
1061
object_upper_bound (address, ns, size));
1048
1062
1049
1063
conditions.push_back (conditiont (
1050
- implies_exprt (not_exprt (dynamic_object (address)), not_exprt (object_bounds_violation)),
1064
+ or_exprt (
1065
+ in_bounds_of_some_explicit_allocation,
1066
+ implies_exprt (
1067
+ not_exprt (dynamic_object (address)),
1068
+ not_exprt (object_bounds_violation))),
1051
1069
" pointer outside object bounds" ));
1052
1070
}
1053
1071
1054
1072
if (flags.is_unknown () || flags.is_integer_address ())
1055
1073
{
1056
1074
conditions.push_back (conditiont (
1057
- implies_exprt (integer_address (address), allocs),
1075
+ implies_exprt (
1076
+ integer_address (address), in_bounds_of_some_explicit_allocation),
1058
1077
" invalid integer address" ));
1059
1078
}
1060
1079
0 commit comments