Skip to content
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

Wrong layout #1041

Closed
e00E opened this issue Sep 26, 2017 · 1 comment
Closed

Wrong layout #1041

e00E opened this issue Sep 26, 2017 · 1 comment

Comments

@e00E
Copy link
Contributor

e00E commented Sep 26, 2017

Input C/C++ Header

#pragma pack(push)
#pragma pack(1)
struct S5 {
   signed f0 : 11;
   unsigned f1 : 12;
   unsigned f2 : 23;
};
#pragma pack(pop)

Bindgen Invocation

$ bindgen failing.h -o failing.rs

Actual Results

While running bindgen we get:

ERROR:bindgen::codegen::struct_layout: Calculated wrong layout for S5, too more 2 bytes

but the output is created nonetheless:

[repr(C)]
#[derive(Debug, Copy)]
pub struct S5 {
    pub _bitfield_1: [u32; 2usize],
    pub __bindgen_align: [u8; 0usize],
}

Then when running the tests:

---- bindgen_test_layout_S5 stdout ----
        thread 'bindgen_test_layout_S5' panicked at 'assertion failed: `(left == right)`
  left: `8`,
 right: `6`: Size of: S5', failing.rs:11:4

Expected Results

@emilio
Copy link
Contributor

emilio commented Sep 26, 2017

Dupe of #537. Thanks for the report!

@emilio emilio closed this as completed Sep 26, 2017
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

No branches or pull requests

2 participants