Skip to content
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

Pointer subtraction in back-end: no need for bounds checking #8497

Merged

Conversation

tautschnig
Copy link
Collaborator

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, but we need to catch this via checks inserted in the front-end, not in the back-end.)

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig tautschnig force-pushed the pointer-subtraction-back-end branch from 33767f9 to 4a92bfc Compare November 7, 2024 09:14
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.)
@tautschnig tautschnig force-pushed the pointer-subtraction-back-end branch from 4a92bfc to eade886 Compare November 7, 2024 09:19
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.76%. Comparing base (beebdda) to head (eade886).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8497      +/-   ##
===========================================
- Coverage    78.80%   78.76%   -0.04%     
===========================================
  Files         1728     1728              
  Lines       198853   198925      +72     
  Branches     18323    18301      -22     
===========================================
- Hits        156700   156686      -14     
- Misses       42153    42239      +86     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tautschnig tautschnig merged commit 83f61a4 into diffblue:develop Nov 7, 2024
37 of 40 checks passed
@tautschnig tautschnig deleted the pointer-subtraction-back-end branch November 7, 2024 10:23
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Nov 28, 2024
This patch release addresses a hard-coding of C semantics in the
back-end for pointer subtraction (via diffblue#8497).
@tautschnig tautschnig mentioned this pull request Nov 28, 2024
3 tasks
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Nov 28, 2024
This patch release addresses a hard-coding of C semantics in the
back-end for pointer subtraction (via diffblue#8497).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants