`extern __mfp8` stack-overflows while parsing the variable (function form becomes `u8`)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
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.
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
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 846
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from rust-lang/rust-bindgen
-
--enable-cxx-namespaces panics on namespace [[deprecated]] { ("[" is not a valid Ident)Possibly taken @lwz23 claimed this 47 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
rust-lang/rust-bindgen#3485 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rust-lang/rust-bindgen#3483 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
rust-lang/rust-bindgen#3370 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rust-lang/rust-bindgen#3363 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
rust-lang/rust-bindgen#3540 ·
Maintainers usually reply within 1 day
All issues in rust-lang/rust-bindgen
Similar issues
-
good first issue help wanted program
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nautechsystems/nautilus_trader#5631 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
bytecodealliance/rustix#1736 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
longbridge/gpui-kit#3871 ·
Maintainers usually reply within 1 day
-
area:models enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day