Skip to content

goto_rw: do not assume that all types have constant size #6719

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

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

tautschnig
Copy link
Collaborator

pointer_offset_bits returns nullopt whenever the size of a type is not a
numeric constant. Such cases arise when arrays have runtime-determined
size, as is the case in regression test byte_update5.

All other places except the one fixed in this commit already considered
the case that pointer_offset_bits returns nullopt.

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

pointer_offset_bits returns nullopt whenever the size of a type is not a
numeric constant. Such cases arise when arrays have runtime-determined
size, as is the case in regression test byte_update5.

All other places except the one fixed in this commit already considered
the case that pointer_offset_bits returns nullopt.
@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #6719 (3cca95c) into develop (ee16d80) will increase coverage by 0.01%.
The diff coverage is 81.03%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6719      +/-   ##
===========================================
+ Coverage    76.80%   76.82%   +0.01%     
===========================================
  Files         1589     1589              
  Lines       183658   183711      +53     
===========================================
+ Hits        141056   141131      +75     
+ Misses       42602    42580      -22     
Impacted Files Coverage Δ
src/analyses/goto_rw.cpp 62.83% <67.64%> (+6.93%) ⬆️
src/analyses/dependence_graph.cpp 90.36% <100.00%> (+0.68%) ⬆️
src/analyses/dependence_graph.h 85.13% <100.00%> (+1.31%) ⬆️
src/analyses/goto_rw.h 68.42% <100.00%> (+3.03%) ⬆️
src/analyses/reaching_definitions.cpp 77.66% <100.00%> (+0.14%) ⬆️
src/pointer-analysis/value_set_fi.cpp 69.78% <0.00%> (+0.32%) ⬆️
src/util/pointer_expr.cpp 74.00% <0.00%> (+2.00%) ⬆️

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 633790b...3cca95c. Read the comment docs.

const exprt simp_offset=simplify_expr(be.offset(), ns);

auto index = numeric_cast<mp_integer>(simp_offset);
if(range_start == -1 || !index.has_value())
if(
range_start == -1 || !index.has_value() ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ magic number

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request forthcoming. Commit already exists, but depends on the various other PRs on this topic.

@tautschnig tautschnig merged commit 2312d47 into diffblue:develop Mar 23, 2022
@tautschnig tautschnig deleted the bugfixes/goto_rw_size branch March 23, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants