-
Notifications
You must be signed in to change notification settings - Fork 274
Fix bit-field and __CPROVER_bool padding for Visual Studio #3636
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
Conversation
tautschnig
commented
Dec 28, 2018
- 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.
62f0be3
to
2ddac46
Compare
There was a problem hiding this 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: 2ddac46).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95940092
2ddac46
to
ed53dae
Compare
There was a problem hiding this 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: ed53dae).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96063022
src/ansi-c/padding.cpp
Outdated
@@ -201,6 +206,8 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns) | |||
offset += (bit_field_bits + pad_bits) / config.ansi_c.char_width; | |||
underlying_bits = bit_field_bits = 0; | |||
} | |||
else | |||
offset += underlying_bits / config.ansi_c.char_width; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong: for example, struct { char x : 4, y : 4, z : 4, w : 4 }
would have a train of 4 bitfields with underlying width 8, would get to the end of the bitfield sequence and then add 1 (underlying bits == 8 / char_width) rather than 2 to offset as it ought to. This probably ought to share the offset code with the case above, for the special case where pad_bits == 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, fixed and regression test based on your example added as well.
src/ansi-c/padding.cpp
Outdated
@@ -252,6 +260,8 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns) | |||
pad_bit_field(components, components.end(), pad); | |||
offset += (bit_field_bits + pad) / config.ansi_c.char_width; | |||
} | |||
else | |||
offset += underlying_bits / config.ansi_c.char_width; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem as above?
ed53dae
to
2e51ea1
Compare
There was a problem hiding this 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: 2e51ea1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96176119
2e51ea1
to
53f0c08
Compare
There was a problem hiding this 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: 53f0c08).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96206271
53f0c08
to
55a53bc
Compare
There was a problem hiding this 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: 55a53bc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96880551
884f837
to
ae79a9a
Compare
There was a problem hiding this 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: ae79a9a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98731167
Bit fields that sum up to the underlying type need to update the offset to ensure padding suitable for the alignment is inserted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR failed Diffblue compatibility checks (cbmc commit: db0990e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/104505849
Status will be re-evaluated on next push.
Common spurious failures:
-
the cbmc commit has disappeared in the mean time (e.g. in a force-push)
-
the author is not in the list of contributors (e.g. first-time contributors).
-
the compatibility was already broken by an earlier merge.