-
Notifications
You must be signed in to change notification settings - Fork 292
Open
Description
C2Rust crashes when transpiling a valid C program that uses the GCC/Clang vector_size extension together with __builtin_shufflevector.
This appears related to incomplete vector/SIMD support, but unlike earlier failures such as unsupported vector initializer lists, this case triggers an internal panic in translator/simd.rs.
Reproducer
typedef int v4si __attribute__((vector_size(16)));
int main(void) {
v4si a = {1, 2, 3, 4};
v4si b = {5, 6, 7, 8};
v4si c = __builtin_shufflevector(a, b, 3, 1, 2, 0);
return c[0];
}
Observed Behavior
C2Rust reports unsupported vector type handling and then panics:
Transpiling test.c
error: Skipping declaration Some(Typedef { name: "v4si", typ: CQualTypeId { qualifiers: Qualifiers { is_const: false, is_restrict: false, is_volatile: false }, ctype: CTypeId(47) }, is_implicit: false, target_dependent_macro: None }) due to error: Unsupported type Vector(CQualTypeId { qualifiers: Qualifiers { is_const: false, is_restrict: false, is_volatile: false }, ctype: CTypeId(31) }, 4)
thread 'main' panicked at 'internal error: entered unreachable code: Found something other than a cast cast: DeclRef(CQualTypeId { qualifiers: Qualifiers { is_const: false, is_restrict: false, is_volatile: false }, ctype: CTypeId(60) }, CDeclId(76), LValue)', c2rust-transpile/src/translator/simd.rs:496:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The input program is valid C using GCC/Clang vector extensions.
Even if this vector/SIMD feature is not yet supported, C2Rust should fail gracefully with a structured error, rather than panicking with entered unreachable code.
Environment
- c2rust version: v0.21.0
- platform: Ubuntu 24.04
- Rust: nightly-2022-08-08
- Clang version: 17.0.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels