Skip to content

Parameter ABI inconsistency error in Rust for RISC-V #141972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
YingkaiLi-VM opened this issue Jun 3, 2025 · 0 comments
Open

Parameter ABI inconsistency error in Rust for RISC-V #141972

YingkaiLi-VM opened this issue Jun 3, 2025 · 0 comments
Labels
A-ABI Area: Concerning the application binary interface (ABI) C-bug Category: This is a bug. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@YingkaiLi-VM
Copy link

The following commands were executed:

./x test --stage 2 --target riscv64gc-unknown-linux-gnu tests/ui 
Error

---- [ui] tests/ui/abi/debug.rs#riscv64 stdout ----
Saved the actual stderr to `/opt/my_rust/rust/build/riscv64gc-unknown-linux-gnu/test/ui/abi/debug.riscv64/debug.riscv64.stderr`
diff of stderr:

32                         mode: Direct(
33                             ArgAttributes {
34                                 regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Zext,
36                                 pointee_size: Size(0 bytes),
37                                 pointee_align: None,
38                             },

91                 conv: Rust,
92                 can_unwind: $SOME_BOOL,
93             }
-         --> $DIR/debug.rs:16:1
+         --> $DIR/debug.rs:18:1
95         |
96      LL | fn test(_x: u8) -> bool { true }
97         | ^^^^^^^^^^^^^^^^^^^^^^^

189                conv: Rust,
190                can_unwind: $SOME_BOOL,
191            }
-         --> $DIR/debug.rs:19:1
+         --> $DIR/debug.rs:21:1
193        |
194     LL | type TestFnPtr = fn(bool) -> u8;
195        | ^^^^^^^^^^^^^^

269                conv: Rust,
270                can_unwind: $SOME_BOOL,
271            }
-         --> $DIR/debug.rs:22:1
+         --> $DIR/debug.rs:24:1
273        |
274     LL | fn test_generic<T>(_x: *const T) { }
275        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

276     
277     error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
-         --> $DIR/debug.rs:25:1
+         --> $DIR/debug.rs:27:1
279        |
280     LL | const C: () = ();
281        | ^^^^^^^^^^^

315                        mode: Direct(
316                            ArgAttributes {
317                                regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Zext,
319                                pointee_size: Size(0 bytes),
320                                pointee_align: None,
321                            },

389                        mode: Direct(
390                            ArgAttributes {
391                                regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Sext,
393                                pointee_size: Size(0 bytes),
394                                pointee_align: None,
395                            },

429                conv: Rust,
430                can_unwind: $SOME_BOOL,
431            }
-         --> $DIR/debug.rs:41:1
+         --> $DIR/debug.rs:43:1
433        |
434     LL | type TestAbiNe = (fn(u8), fn(u32));
435        | ^^^^^^^^^^^^^^

585                conv: Rust,
586                can_unwind: $SOME_BOOL,
587            }
-         --> $DIR/debug.rs:44:1
+         --> $DIR/debug.rs:46:1
589        |
590     LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32]));
591        | ^^^^^^^^^^^^^^^^^^^^

698                        mode: Direct(
699                            ArgAttributes {
700                                regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Sext,
702                                pointee_size: Size(0 bytes),
703                                pointee_align: None,
704                            },

738                conv: Rust,
739                can_unwind: $SOME_BOOL,
740            }
-         --> $DIR/debug.rs:47:1
+         --> $DIR/debug.rs:49:1
742        |
743     LL | type TestAbiNeFloat = (fn(f32), fn(u32));
744        | ^^^^^^^^^^^^^^^^^^^

778                        mode: Direct(
779                            ArgAttributes {
780                                regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Sext,
782                                pointee_size: Size(0 bytes),
783                                pointee_align: None,
784                            },

852                        mode: Direct(
853                            ArgAttributes {
854                                regular: NoUndef,
-                                  arg_ext: None,
+                                  arg_ext: Sext,
856                                pointee_size: Size(0 bytes),
857                                pointee_align: None,
858                            },

892                conv: Rust,
893                can_unwind: $SOME_BOOL,
894            }

Based on the description of parameter passing in registers from https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc, I believe this is an error in the unit test itself, and I intend to fix it.

@YingkaiLi-VM YingkaiLi-VM added the C-bug Category: This is a bug. label Jun 3, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 3, 2025
@workingjubilee workingjubilee added O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-ABI Area: Concerning the application binary interface (ABI) labels Jun 3, 2025
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ABI Area: Concerning the application binary interface (ABI) C-bug Category: This is a bug. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants