Skip to content

Thread 'bindgen_test_layout_header' panicked at 'assertion failed: (left == right) #943

Open
@helloqirun

Description

I am using this script (https://gist.github.com/fitzgen/187381e358f60efa8194d0b276b4d11a) for testing.
The hashtag for my bindgen version is e841f6f.

$ ./b.sh bindgen abc.h

clang-4.0: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
abc.h:6:19: warning: unknown attribute 'size' ignored [-Wunknown-attributes]
} __attribute__ ((size, packed));
                  ^
1 warning generated.
abc.h:6:19: warning: unknown attribute 'size' ignored [-Wunknown-attributes], err: false

running 1 test
test bindgen_test_layout_header ... FAILED

failures:

---- bindgen_test_layout_header stdout ----
        thread 'bindgen_test_layout_header' panicked at 'assertion failed: `(left == right)`
  left: `5`,
 right: `8`: Size of: header', /tmp/bindings-hJzMPE.rs:46:4
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:380
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:390
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:611
   5: std::panicking::begin_panic_new
             at /checkout/src/libstd/panicking.rs:553
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:521
   7: bindings_hJzMPE::bindgen_test_layout_header
   8: <F as test::FnBox<T>>::call_box
             at /checkout/src/libtest/lib.rs:1477
             at /checkout/src/libcore/ops/function.rs:143
             at /checkout/src/libtest/lib.rs:138
   9: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98


failures:
    bindgen_test_layout_header

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

Interesting: bindgen emitted type definitions that are failing their
layout unit tests!

$ cat abc.h

struct header
{
  char proto;
  unsigned int size __attribute__ ((packed));
  unsigned char data[] __attribute__ ((aligned (8)));
} __attribute__ ((size, packed));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions