Skip to content

Conversation

@tautschnig
Copy link
Collaborator

The previous implementation (from e672e0d) would not account for
loop heads with side effects.

Fixes: #5450

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

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

Yep; that looks like the kind of fix that is needed. Are there already tests for the kind of loop it is supposed to target?

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Are you sure your test case exercises the new code? I'd expect the first loop to leave count == 5 in the constant propagator. Then the second loop (the empty do-while) would use the empty-loop special case, but the third loop would probably be skipped by plain constant propagation evaluating the conditional jump statically before we consider if it's an empty loop?

@smowton
Copy link
Contributor

smowton commented Aug 12, 2020

(Either way it'd be worth adding comments to the test-case indicating what you expect to happen)

@hannes-steffenhagen-diffblue
Copy link
Contributor

@smowton This definitely fixes the reported issue

Copy link
Contributor

@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue left a comment

Choose a reason for hiding this comment

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

LGTM (the way I understood this this previously replaced all empty or seemingly “empty” loops with assume false, and now only does if the loop condition can be simplified to true?).

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

OK, if you're sure it works as advertised

@tautschnig
Copy link
Collaborator Author

OK, if you're sure it works as advertised

Well, now at least it is being tested...

The previous implementation (from e672e0d) would not account for
loop heads with side effects. Also, no tests existed for this
transformation, which are now added.

Fixes: diffblue#5450
@codecov
Copy link

codecov bot commented Aug 12, 2020

Codecov Report

Merging #5455 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5455   +/-   ##
========================================
  Coverage    68.23%   68.23%           
========================================
  Files         1178     1178           
  Lines        97588    97590    +2     
========================================
+ Hits         66589    66592    +3     
+ Misses       30999    30998    -1     
Flag Coverage Δ
#cproversmt2 42.81% <100.00%> (+<0.01%) ⬆️
#regression 65.40% <100.00%> (+<0.01%) ⬆️
#unit 32.23% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/goto-symex/symex_goto.cpp 97.00% <100.00%> (+0.39%) ⬆️

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 7d30335...e15e121. Read the comment docs.

@tautschnig tautschnig merged commit 8a99f23 into diffblue:develop Aug 13, 2020
@tautschnig tautschnig deleted the fix-5450 branch August 13, 2020 11:40
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.

CBMC smybolic execution soundness issue; backwards goto missed in do ... while loop

5 participants