-
Notifications
You must be signed in to change notification settings - Fork 274
fix anonymous struct member initialization #3716
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
(components[entry.index].get_is_padding() || | ||
components[entry.index].type().id()==ID_code)) | ||
components[entry.index].get_anonymous() || |
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 causes Struct_Padding1 to fail, which contains an anonymous struct as part of the test. Should this test here be restricted to bitfields?
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.
fixed -- it should be restricted to scalars.
b80ba12
to
4338b33
Compare
(components[entry.index].get_is_padding() || | ||
components[entry.index].type().id()==ID_code)) | ||
(components[entry.index].get_anonymous() && | ||
components[entry.index].type().id() != ID_struct_tag) || |
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.
unions should be exempt as well:
#include <assert.h>
struct S
{
int i;
union
{
int a;
int b;
};
int j;
} s = { 1, { 2 }, 3 };
int main()
{
assert(s.i == 1);
assert(s.a == 2);
assert(s.b == 2);
assert(s.j == 3);
return 0;
}
(and it may be worth adding such a test)
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.
done
The C front-end needs to ignore the unnamed bit-field during struct initialization; issue #3709.
4338b33
to
4548fc1
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 4338b33).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96610343
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
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 incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
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: 4548fc1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96632876
The C front-end needs to ignore the unnamed bit-field during struct
initialization; issue #3709.