Skip to content

Fix handling of case range statement in special case #3055

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 2 commits into from
Sep 28, 2018

Conversation

NlightNFotis
Copy link
Contributor

@NlightNFotis NlightNFotis commented Sep 27, 2018

In the case where a gcc case range switch statement has a case that reduces to an empty expression, both gcc and clang reluctantly accept it, producing warnings. CBMC up until now was asserting against that case, and this divergence in behaviour was unwanted.

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
    • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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).
  • 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.

@tautschnig
Copy link
Collaborator

tautschnig commented Sep 27, 2018

Couldn't we have just the new commit in this PR? I think that's an independent problem and we shouldn't entangle that with the other PR. In fact I think #2905 should eventually depend on this one.

Edit: sorry, I should have read the comment on #2905 first. #2905 is merged, this one should now be rebased (and then likely needs more discussion).

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

Passed Diffblue compatibility checks (cbmc commit: a076249).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86181339

In the case where a gcc case range switch statement has
a case that reduces to an empty expression, both gcc and
clang reluctantly accept it, producing warnings. CBMC up
until now was asserting against that case, and this
divergence in behaviour was unwanted.
@NlightNFotis NlightNFotis force-pushed the fix_case_range_behaviour branch from a076249 to 7685476 Compare September 28, 2018 10:15
@NlightNFotis
Copy link
Contributor Author

@tautschnig I have rebased it appropriately now. It should be ready for more discussion/review now.

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.

Could you please add another test case where all/the only case is an empty one? Basically a variant of the existing goto_convert_switch_range_empty test without the default case.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

Passed Diffblue compatibility checks (cbmc commit: 7685476).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86275983

@NlightNFotis
Copy link
Contributor Author

@tautschnig Yes, done.

@tautschnig tautschnig merged commit d310d2c into diffblue:develop Sep 28, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

Passed Diffblue compatibility checks (cbmc commit: 5da7d4f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86295457

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.

3 participants