SVE `__SVInt32_t` parameters become a zero-sized opaque; rustc drops the argument
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
提供された input.h と bindgen の呼び出しで問題を再現し、その後、SVE のサイズレスベクトル型に対する from_clang_ty の処理を調査してください。修正では、生成されるシグネチャで実際のスケーラブルベクトル ABI を維持するか、警告を出して take をスキップし、rustc がパラメータをゼロサイズ型として削除しないようにする必要があります。
索引モデルが issue の本文から書いたものです。
説明
Input C/C++ Header
int take(__SVInt32_t a, int t);
Bindgen Invocation
$ bindgen input.h -- -std=gnu11 -march=armv9-a+sve
Actual Results
bindgen 0.72.1 and 0.73.1 both turn the sizeless SVE vector into a zero-sized opaque blob (exit 0, default layout tests rustc-ok):
// 0.73.1
pub fn take(a: __BindgenOpaqueArray16<[u8; 0]>, t: c_int) -> c_int;
// 0.72.1
pub fn take(a: __BindgenOpaqueArray<u128, 0>, t: c_int) -> c_int;
Clang's LLVM for the same header keeps the scalable vector argument:
define i32 @take(<vscale x 4 x i32> %0, i32 noundef %1)
rustc of the generated bindings drops the ZST from the FFI signature (twice on each bindgen):
declare i32 @take(i32)
This is not GNU vector_size / ext_vector_type / NEON (those become arrays of the lane type). __SVInt32_t is a sizeless ACLE builtin; libclang reports size 0, and bindgen's opaque fallback uses that layout as the FFI argument. It is also not #727 / #3475: those are calling-convention enums on functions / function pointers. Here the data type of a parameter is wrong.
from_clang_ty has no arm for SVE sizeless vector kinds; they fall through to the opaque layout path with size 0.
Expected Results
Map SVE vector parameters as a real scalable-vector ABI (or skip take with a warning), not a ZST that rustc deletes from the signature.
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 (Apple M4)
- 主要言語
- Rust
- スター
- 5.3k
- フォーク
- 846
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-lang/rust-bindgen のほかの issue
-
--enable-cxx-namespaces panics on namespace [[deprecated]] { ("[" is not a valid Ident)対応中かも @lwz23 が 49 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
rust-lang/rust-bindgen#3485 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rust-lang/rust-bindgen#3483 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
rust-lang/rust-bindgen#3370 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
rust-lang/rust-bindgen#3363 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
rust-lang/rust-bindgen#3540 ·
メンテナーはふだん 1 日以内に返信
rust-lang/rust-bindgen の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openfootmanager/openfootmanager#1365 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
JackMechem/marbble#305 ·
メンテナーはふだん 1 日以内に返信