Skip to content

SIGSEGV / Segfault in 0.61.0 #2395

Open
@SWW13

Description

@SWW13

I just upgraded bindgen to 0.63.0 and was greeted with a segfault. A little bit of manual bisect yielded version 0.61.0 as the first offender.

I'll start digging deeper into the issue soon, I plan to do a git bisect to figure out the commit that introduced the issue and if that doesn't help try to get my build-system running with gdb attached for a backtrace. I'm also open to other debugging suggestions.

Note: this could be duplicate of #2035, but bindgen still works fine for me up until the segfault in 0.61.0 and above.

Input C/C++ Header

It's a large code base with long build times, I'd rather not try to find a minimal reproducer if possible.

Bindgen Invocation

bindgen::Builder::default()
        .derive_debug(true)
        .derive_default(true)
        .impl_debug(true)
        .generate_comments(true)
        .default_enum_style(bindgen::EnumVariation::NewType {
            is_bitfield: false,
            is_global: false, // new in `0.61.0`, same crash with `true`
        })
        .header("wrapper.h")
        .clang_args(crate::bindgen_clang_args()) // extracted from build target
        .allowlist_*("...")
        .blocklist_function("main_loop_wait") // bindgen issue #1313
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .generate()

Actual Results

error: failed to run custom build command for `crate`

Caused by:
  process didn't exit successfully: `/crate-b7933947bb539228/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)

Expected Results

No segfault.

Metadata

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