Closed
Description
Input C/C++ Header
#pragma pack(2)
struct Test {
unsigned long x;
char a;
char b;
char c;
};
Bindgen Invocation
$ bindgen input.h --explicit-padding
Actual Results
panicked at bindgen/codegen/struct_layout.rs:309:20:
attempt to subtract with overflow
Analysis
The reason this happens is because in saw_field_with_layout
, padding bytes size is always calculated using the specified pack alignment, i.e. 2 bytes. however, if the field itself has a smaller alignment requirement, that should be used instead.
Metadata
Metadata
Assignees
Labels
No labels