Skip to content

Fix f16/f128 TypeKind UB causing SIGTRAP on aarch64#374

Merged
LegNeato merged 1 commit intoRust-GPU:mainfrom
LegNeato:fix-f16-f128-typekind
Apr 4, 2026
Merged

Fix f16/f128 TypeKind UB causing SIGTRAP on aarch64#374
LegNeato merged 1 commit intoRust-GPU:mainfrom
LegNeato:fix-f16-f128-typekind

Conversation

@LegNeato
Copy link
Copy Markdown
Contributor

@LegNeato LegNeato commented Apr 4, 2026

The TypeKind repr(C) enum was missing X86_FP80, FP128, and PPC_FP128 variants. When compiler_builtins is compiled with --cfg f128_enabled (new in recent nightlies), the C FFI function LLVMRustGetTypeKind returns 5 for fp128 types. The Rust enum had no variant for that discriminant, causing instant undefined behavior. I saw this manifesting as SIGTRAP.

Also adds f16 and f128 cases to the ABI Reg::llvm_type float match, which previously only handled 32 and 64-bit floats.

The `TypeKind` repr(C) enum was missing `X86_FP80`, `FP128`, and
`PPC_FP128` variants (values 4, 5, 6). When `compiler_builtins` is
compiled with `--cfg f128_enabled` (new in recent nightlies), the C FFI
function `LLVMRustGetTypeKind` returns 5 for fp128 types. The Rust enum
had no variant for that discriminant, causing instant undefined behavior
(manifesting as SIGTRAP).

Also adds f16 and f128 cases to the ABI `Reg::llvm_type` float match,
which previously only handled 32 and 64-bit floats.
@LegNeato LegNeato added this pull request to the merge queue Apr 4, 2026
Merged via the queue into Rust-GPU:main with commit 0bc607f Apr 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant