rust-lang / rust-lang/rust-bindgen
`extern __mfp8` stack-overflows while parsing the variable (function form becomes `u8`)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
extern __mfp8 G;
Bindgen Invocation
$ bindgen input.h
Actual Results
bindgen never produces bindings. On Darwin it dies with EXC_BAD_ACCESS (shell status 139) after overflowing the stack. lldb stops in HashMap<ItemId, ()>::insert with a stack address, which is the usual signature of unbounded recursion while parsing the type.
The same abort happens for __mfp8 G;, static __mfp8 G;, const __mfp8 G;, and extern const __mfp8 G;. extern __mfp8 A[4]; hangs until killed (same recursion, slower).
A function using the same type does not abort. It goes through the opaque-size fallback:
__mfp8 take(__mfp8 a);
unsafe extern "C" { pub fn take(a: u8) -> u8; }
__mfp8 is clang's ACLE 8-bit float builtin. libclang presents a builtin type that is not in build_builtin_ty. Function/field/pointer/typedef forms therefore become u8. Variable declarations recurse instead of taking that fallback.
Reproduced with bindgen 0.72.1 and 0.73.1.
Expected Results
Do not recurse or abort. Skip the variable, or use the same size-based fallback already used for __mfp8 parameters (u8), ideally without claiming a real 8-bit float ABI.
Environment
bindgen: 0.72.1 and 0.73.1 (rust-lang/rust-bindgen 77cbc723)
clang/libclang: Homebrew clang 21.1.8
rustc: 1.97.1
target: aarch64-apple-darwin
OS: macOS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with bindgen on the listed __mfp8 variable and function declarations, then trace variable parsing alongside the build_builtin_ty path mentioned in the report. Done means variable declarations no longer recurse or abort, while the existing function-form fallback remains intact; verify the reported headers and array case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100