@@ -992,12 +992,16 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
992992 alloc_disjuncts.push_back (and_exprt (lb_check, ub_check));
993993 }
994994
995- const exprt allocs = disjunction (alloc_disjuncts);
995+ const exprt in_bounds_of_some_explicit_allocation =
996+ disjunction (alloc_disjuncts);
996997
997998 if (flags.is_unknown () || flags.is_null ())
998999 {
9991000 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" ));
10011005 }
10021006
10031007 if (flags.is_unknown ())
@@ -1010,21 +1014,28 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
10101014 if (flags.is_uninitialized ())
10111015 {
10121016 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))),
10141020 " pointer uninitialized" ));
10151021 }
10161022
10171023 if (flags.is_unknown () || flags.is_dynamic_heap ())
10181024 {
10191025 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))),
10211029 " deallocated dynamic object" ));
10221030 }
10231031
10241032 if (flags.is_unknown () || flags.is_dynamic_local ())
10251033 {
10261034 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" ));
10281039 }
10291040
10301041 if (flags.is_unknown () || flags.is_dynamic_heap ())
@@ -1034,7 +1045,10 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
10341045 dynamic_object_upper_bound (address, ns, size));
10351046
10361047 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))),
10381052 " pointer outside dynamic object bounds" ));
10391053 }
10401054
@@ -1047,14 +1061,19 @@ goto_checkt::address_check(const exprt &address, const exprt &size)
10471061 object_upper_bound (address, ns, size));
10481062
10491063 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))),
10511069 " pointer outside object bounds" ));
10521070 }
10531071
10541072 if (flags.is_unknown () || flags.is_integer_address ())
10551073 {
10561074 conditions.push_back (conditiont (
1057- implies_exprt (integer_address (address), allocs),
1075+ implies_exprt (
1076+ integer_address (address), in_bounds_of_some_explicit_allocation),
10581077 " invalid integer address" ));
10591078 }
10601079
0 commit comments