Skip to content

signed left-shift overflow depends on standard version #3690

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
Jan 7, 2019

Conversation

kroening
Copy link
Member

@kroening kroening commented Jan 5, 2019

The semantics of signed left shifts are contentious for the case
that a '1' is shifted into the signed bit.
Assuming 32-bit integers, 1<<31 is implementation-defined
in ANSI C and C++98, but is explicitly undefined by C99,
C11 and C++11.

  • 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.
  • 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
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: 3e0164e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96381233

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.

Add an extra variant of the test with --c99?

@kroening
Copy link
Member Author

kroening commented Jan 6, 2019

Sure, done

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: 689b2da).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96410366

Daniel Kroening added 2 commits January 7, 2019 11:19
This fixes a copy & paste error.
The semantics of signed left shifts are contentious for the case
that a '1' is shifted into the signed bit.
Assuming 32-bit integers, 1<<31 is implementation-defined
in ANSI C and C++98, but is explicitly undefined by C99,
C11 and C++11.
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: ae78609).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96465454

@tautschnig tautschnig merged commit f873334 into develop Jan 7, 2019
@tautschnig tautschnig deleted the shl-overflow2 branch January 7, 2019 12:42
@smowton
Copy link
Contributor

smowton commented Jan 7, 2019

@kroening it looks like you renamed the test.desc to -c89.desc but never added the -c99.desc version which I assume existed on your local system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants