Skip to content

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

Merged
merged 1 commit into from
Apr 17, 2019

Conversation

tautschnig
Copy link
Collaborator

  • 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
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: 2ddac46).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95940092

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

@@ -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;
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same problem as above?

tautschnig added a commit that referenced this pull request Jan 2, 2019
Make Powershell stop on errors [depends-on: #3616, blocks: #2310, #3636, #3637]
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: 2e51ea1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96176119

@tautschnig tautschnig changed the title Fix bit-field and __CPROVER_bool padding for Visual Studio [depends-on: #3627] Fix bit-field and __CPROVER_bool padding for Visual Studio Jan 3, 2019
@tautschnig tautschnig assigned kroening and unassigned tautschnig Jan 3, 2019
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: 53f0c08).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96206271

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: 55a53bc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96880551

@tautschnig tautschnig force-pushed the fix-padding branch 2 times, most recently from 884f837 to ae79a9a Compare January 27, 2019 10:40
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: 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.
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.

⚠️
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.

@kroening kroening merged commit f08c5e9 into diffblue:develop Apr 17, 2019
@tautschnig tautschnig deleted the fix-padding branch April 17, 2019 12:51
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.

4 participants