Skip to content

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

Open
@YingkaiLi-VM

Description

@YingkaiLi-VM

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.O-riscvTarget: RISC-V architectureT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions