Skip to content

CONTRACTS: Fix targett comparison in loop instrumentation #6782

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
Apr 6, 2022

Conversation

SaswatPadhi
Copy link
Contributor

An inequality comparison on iterators was leading to undefined behavior and flakiness: incorrect instrumentation loop contracts.

  • 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.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Collaborator

@feliperodri feliperodri left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

I don't quite agree with the commit message: https://github.com/diffblue/cbmc/blob/develop/src/goto-programs/goto_program.h#L1240..L1245 is what is being invoked here. That's not undefined behaviour, but will be behaviour that may not be as reproducible.

And then also the issue that I commented on below, which might be what resulted in breaking some tests.

Inequality comparison on targett iterators are overloaded to compare
raw pointers instead. This led to flakiness: incorrect instrumentation
of loop contracts in some runs.
@SaswatPadhi SaswatPadhi changed the title CONTRACTS: Fix undefined behavior on iterator comparison CONTRACTS: Fix targett comparison in loop instrumentation Apr 5, 2022
@SaswatPadhi
Copy link
Contributor Author

SaswatPadhi commented Apr 5, 2022

Thanks for the review, @tautschnig and @feliperodri.

@tautschnig: I think I have addressed all your comments now.

@tautschnig tautschnig merged commit f3e4096 into diffblue:develop Apr 6, 2022
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Apr 6, 2022
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Apr 9, 2022
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Apr 9, 2022
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request Jan 11, 2023
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request May 17, 2023
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request May 22, 2023
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request May 23, 2023
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
tautschnig added a commit to tautschnig/cbmc that referenced this pull request May 30, 2023
This makes sure no one can inadvertently use less-than comparison on
those iterators, which may lead to non-reproducible behaviour
(see diffblue#6782).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Code Contracts Function and loop contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants