You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled over an issue in bindgen today where the auto-generated test fails due to an unexpected size of the struct. The input header generated from creduce seems easy enough so it might also be that I am missing something? Is there any other information I could provide?
Input C Header
typedefstruct {
long doublea
} max_align_t;
Bindgen Invocation
let bindings = bindgen::Builder::default().header("isolated-test-case.h").generate().expect("Unable to generate bindings");
Actual Results
-*- mode: compilation; default-directory: "~/repos/azure-iot-hub-sys/" -*-
Compilation started at Mon Feb 18 17:25:09
RUST_BACKTRACE=1 cargo t
Blocking waiting for file lock on build directory
Compiling azure-iot-hub-sys v0.1.0 (/home/christian/repos/azure-iot-hub-sys)
Finished dev [unoptimized + debuginfo] target(s) in 1.74s
Running target/debug/deps/azure_iot_hub_sys-6b0efcabc2d22f67
running 2 tests
test tests::it_works ... ok
test bindgen_test_layout_max_align_t ... FAILED
failures:
---- bindgen_test_layout_max_align_t stdout ----
thread 'bindgen_test_layout_max_align_t' panicked at 'assertion failed: `(left == right)`
left: `8`,
right: `16`: Size of: max_align_t', /home/christian/repos/azure-iot-hub-sys/target/debug/build/azure-iot-hub-sys-121d4cf2ab9da7ba/out/bindings.rs:10:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:211
3: std::panicking::default_hook
at src/libstd/panicking.rs:221
4: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:491
5: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:398
6: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:353
7: azure_iot_hub_sys::bindgen_test_layout_max_align_t
at ./target/debug/build/azure-iot-hub-sys-121d4cf2ab9da7ba/out/bindings.rs:10
8: azure_iot_hub_sys::bindgen_test_layout_max_align_t::{{closure}}
at ./target/debug/build/azure-iot-hub-sys-121d4cf2ab9da7ba/out/bindings.rs:9
9: core::ops::function::FnOnce::call_once
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/ops/function.rs:238
10: <F as alloc::boxed::FnBox<A>>::call_box
at src/libtest/lib.rs:1471
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/ops/function.rs:238
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/liballoc/boxed.rs:673
11: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:102
failures:
bindgen_test_layout_max_align_t
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--lib'
Compilation exited abnormally with code 101 at Mon Feb 18 17:25:11
and/or
/* automatically generated by rust-bindgen */#[repr(C)]#[derive(Debug,Copy,Clone)]pubstructmax_align_t{puba:f64,}#[test]fnbindgen_test_layout_max_align_t(){assert_eq!(::std::mem::size_of::<max_align_t>(),16usize,
concat!("Size of: ", stringify!(max_align_t)));assert_eq!(unsafe{&(*(::std::ptr::null::<max_align_t>())).a as*const _ asusize},0usize,
concat!("Offset of field: ",
stringify!(max_align_t),"::",
stringify!(a)));}
Expected Results
It seems strange to me that bindgen expected the struct to be 16 bytes wide.
The text was updated successfully, but these errors were encountered:
I stumbled over an issue in bindgen today where the auto-generated test fails due to an unexpected size of the struct. The input header generated from
creduce
seems easy enough so it might also be that I am missing something? Is there any other information I could provide?Input C Header
Bindgen Invocation
Actual Results
and/or
Expected Results
It seems strange to me that bindgen expected the struct to be 16 bytes wide.
The text was updated successfully, but these errors were encountered: