Skip to content

Assignment side effects may require additional temporaries #5858

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
Feb 23, 2021

Conversation

tautschnig
Copy link
Collaborator

An assignment may invalidate pointers used in the left-hand side. In
case the result of the assignment is used, we therefore cannot re-use
the left-hand side to represent the result. Instead, introduce
temporaries as needed to store the right-hand side value, and use the
temporary to represent the result.

Fixes: #5857

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

An assignment may invalidate pointers used in the left-hand side. In
case the result of the assignment is used, we therefore cannot re-use
the left-hand side to represent the result. Instead, introduce
temporaries as needed to store the right-hand side value, and use the
temporary to represent the result.

Fixes: diffblue#5857
@tautschnig tautschnig removed their assignment Feb 23, 2021
@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #5858 (a59f36b) into develop (c4db021) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5858   +/-   ##
========================================
  Coverage    72.89%   72.89%           
========================================
  Files         1423     1423           
  Lines       154229   154243   +14     
========================================
+ Hits        112426   112440   +14     
  Misses       41803    41803           
Impacted Files Coverage Δ
src/goto-programs/goto_convert_class.h 87.30% <ø> (ø)
src/goto-programs/goto_clean_expr.cpp 99.48% <100.00%> (ø)
src/goto-programs/goto_convert_side_effect.cpp 93.10% <100.00%> (+0.31%) ⬆️

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 308cc0a...a59f36b. Read the comment docs.

@tautschnig tautschnig merged commit a4c81ef into diffblue:develop Feb 23, 2021
@tautschnig tautschnig deleted the fix-5857 branch February 23, 2021 21:30
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Feb 24, 2021
The fixes in diffblue#5858 addressed the problem of assignments having side
effects, but did not consider function calls or pre-increment/decrement,
which eventually also yield assignments, and thus may have similar side
effects.
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.

Spurious null-pointer failure on self-referential data structure
2 participants