Commit eade886
committed
Pointer subtraction in back-end: no need for bounds checking
5b8028a added pointer validity checks in the back-end when
performing pointer minus pointer operations. Given our pointer encoding
it seems important to do a same-object test as, for distinct objects,
the object identifier part would start to play into the subtraction.
When operating on the same object, however, even out-of-bounds pointers'
subtraction should be indistinguishable from how this works on actual
hardware.
Therefore, this commit removes the bounds-checking part. (C semantics
have a pointer-validity requirement, and we catch this via checks
inserted in the front-end as the regression test demonstrates. We do not
need to catch this in the back-end.)1 parent beebdda commit eade886
File tree
2 files changed
+5
-36
lines changed- regression/cbmc/Pointer_difference2
- src/solvers/flattening
2 files changed
+5
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
| 668 | + | |
| 669 | + | |
701 | 670 | | |
702 | 671 | | |
703 | 672 | | |
| |||
0 commit comments