Skip to content

Simplify equality of address-of-string-constant #6967

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

Conversation

tautschnig
Copy link
Collaborator

The back-end assumes that each string is a singleton and, therefore,
taking the address of a particular string constant will always result in
the same value. The simplifier can use this information.

Fixes: #6966

  • 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.

The back-end assumes that each string is a singleton and, therefore,
taking the address of a particular string constant will always result in
the same value. The simplifier can use this information.

Fixes: diffblue#6966
@codecov
Copy link

codecov bot commented Jun 24, 2022

Codecov Report

Merging #6967 (897034a) into develop (7c89e91) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #6967   +/-   ##
========================================
  Coverage    77.83%   77.83%           
========================================
  Files         1568     1568           
  Lines       180361   180365    +4     
========================================
+ Hits        140378   140382    +4     
  Misses       39983    39983           
Impacted Files Coverage Δ
src/util/simplify_expr_pointer.cpp 85.79% <100.00%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 026931f...897034a. Read the comment docs.

@kroening
Copy link
Member

We may need to do something about the fact that the C standard doesn't actually guarantee that two identical string literals get the same address.

@kroening kroening merged commit 240daac into diffblue:develop Jun 24, 2022
@tautschnig tautschnig deleted the bugfixes/6966-simplify-string-constant-eq branch June 27, 2022 07:35
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.

break statement does not break from loop
3 participants