rust icon indicating copy to clipboard operation
rust copied to clipboard

Fix RISC-V C function ABI when passing/returning structs containing floats

Open beetrees opened this issue 9 months ago • 9 comments

RISC-V passes structs containing only one or two floats (or a float and integer pair) in registers, as long as the individual floats/integers fit in a single corresponding register (see the ABI specification for details). Before this PR, Rust would not check what offset the second float/integer was at, instead assuming that it was at the standard offset for its default alignment. However, as the offset can be affected by #[repr(align(N))] and #[repr(packed)], this caused miscompilations (see #115609). To fix this, this PR introduces a rest_offset field to CastTarget that can be used to explicitly specify at what offset the rest part of the cast is located at.

While fixing this, I discovered another bug: the size of the cast target was being used as the size of the MIR return place (when the function was using a PassMode::Cast return type). However, the cast target is allowed to be smaller than the size of the actual type, causing a miscompilation. This PR fixes this issue by using the largest of the size of the type and the size of the cast target as the size of the MIR return place, ensuring all reads/writes will be inbounds.

Fixes the RISC-V part of #115609.

cc target maintainers of riscv64gc-unknown-linux-gnu: @kito-cheng @michaelmaitland @robin-randhawa-sifive @topperc

r? @workingjubilee

beetrees avatar Apr 03 '25 22:04 beetrees

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

rustbot avatar Apr 03 '25 22:04 rustbot

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#19 exporting to docker image format
#19 sending tarball 19.7s done
#19 DONE 25.8s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
  Number of decisions:   4447
  longest path:          1159 (code:    152)
  longest backtrack:       66 (code:    428)
Shared 86733 out of 152951 states by creating 14756 new states, saving 71977
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc: In function ‘rtx_def* extract_bit_field_1(rtx, poly_uint64, poly_uint64, int, rtx, machine_mode, machine_mode, bool, bool, rtx_def**)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1864:45: warning: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ may be used uninitialized [-Wmaybe-uninitialized]
 1864 |       rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 1865 |                                              bitsize, bitnum);
      |                                              ~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1824:19: note: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ was declared here
 1824 |   scalar_int_mode imode;
      |                   ^~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc: In member function ‘void range_def_chain::dump(FILE*, basic_block, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc:319:19: warning: format not a string literal and no format arguments [-Wformat-security]
  319 |           fprintf (f, prefix);
      |           ~~~~~~~~^~~~~~~~~~~
---
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:7930:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 7930 |   write (fd, "\n\n", 2);
      |   ~~~~~~^~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc: In member function ‘void driver::final_actions() const’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:9307:13: warning: ignoring return value of ‘int truncate(const char*, __off_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 9307 |     truncate(totruncate_file, 0);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto-wrapper.cc: In function ‘bool find_and_merge_options(int, off_t, const char*, vec<cl_decoded_option>, bool, vec<cl_decoded_option>*, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto-wrapper.cc:1165:8: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1165 |   read (fd, data, length);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc: In function ‘void lto_resolution_read(splay_tree, FILE*, lto_file*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2091:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2091 |   fscanf (resolution, " ");   /* Read white space.  */
      |   ~~~~~~~^~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2093:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2093 |   fread (obj_name, sizeof (char), name_len, resolution);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2113:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2113 |   fscanf (resolution, "%u", &num_symbols);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/jit/jit-recording.cc:32:
---
Applying io_quotes_use            to linux/blkzoned.h
Applying io_quotes_use            to linux/ipmi.h
Applying io_quotes_use            to linux/psp-dbc.h
Applying io_quotes_use            to linux/bt-bmc.h
Applying io_quotes_use            to linux/tps6594_pfsm.h
Applying io_quotes_use            to linux/cxl_mem.h
Applying io_quotes_use            to linux/wmi.h
Applying io_quotes_use            to linux/auto_fs.h
Applying io_quotes_use            to linux/mmtimer.h
Applying io_quotes_use            to linux/f2fs.h
Applying io_quotes_use            to linux/vhost.h
---
Applying machine_name             to x86_64-linux-gnu/bits/unistd_ext.h
Applying io_quotes_use            to x86_64-linux-gnu/asm/mtrr.h
Applying io_quotes_use            to x86_64-linux-gnu/asm/amd_hsmp.h
Applying machine_name             to openssl/e_os2.h
Applying io_quotes_use            to drm/xe_drm.h
Applying io_quotes_use            to drm/radeon_drm.h
Applying io_quotes_use            to drm/panfrost_drm.h
Applying io_quotes_use            to drm/etnaviv_drm.h
Applying io_quotes_use            to drm/lima_drm.h
Applying io_quotes_use            to drm/qaic_accel.h
Applying io_quotes_use            to drm/vc4_drm.h
Applying io_quotes_use            to drm/i915_drm.h
Applying io_quotes_use            to drm/omap_drm.h
Applying io_quotes_use            to drm/pvr_drm.h
Applying io_quotes_use            to drm/amdgpu_drm.h
Applying io_quotes_use            to drm/vgem_drm.h
Applying io_quotes_use            to drm/msm_drm.h
Applying io_quotes_use            to drm/v3d_drm.h
Applying io_quotes_use            to drm/exynos_drm.h
Applying io_quotes_use            to drm/nouveau_drm.h
Applying io_quotes_use            to drm/drm.h
Applying io_quotes_use            to drm/habanalabs_accel.h
Applying io_quotes_use            to drm/tegra_drm.h
Applying io_quotes_use            to rdma/rdma_user_ioctl.h
cc1: note: self-tests are not enabled in this build
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/c++tools/server.cc: In function ‘void server(bool, int, module_resolver*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/c++tools/server.cc:620:10: warning: ignoring return value of ‘int pipe(int*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
---
failures:

---- [assembly] tests/assembly/riscv-float-struct-abi.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-18/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s" "/checkout/tests/assembly/riscv-float-struct-abi.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/assembly/riscv-float-struct-abi.rs:87:17: error: CHECK-NEXT: is not on the line after the previous match
 // CHECK-NEXT: srli [[BYTE4:.*]], [[VALUE]], 24
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:67:2: note: 'next' match was here
 srli a2, a1, 24
 ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:65:14: note: previous match ended here
 lw a1, 8(sp)
             ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:66:1: note: non-matching line after previous match is here
 sb a1, 1(a0)
^
/checkout/tests/assembly/riscv-float-struct-abi.rs:154:17: error: CHECK-NEXT: is not on the line after the previous match
 // CHECK-NEXT: srli [[BYTE4:.*]], [[VALUE]], 24
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:140:2: note: 'next' match was here
 srli a1, a0, 24
 ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:138:14: note: previous match ended here
 lw a0, 8(sp)
             ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:139:1: note: non-matching line after previous match is here
 sb a0, 1(s0)
^

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s
Check file: /checkout/tests/assembly/riscv-float-struct-abi.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1:  .text 
          2:  .attribute 4, 16 
          3:  .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" 
          4:  .file "riscv_float_struct_abi.2ae10ca39861278-cgu.0" 
          5:  .section .text.pass_padded,"ax",@progbits 
          6:  .globl pass_padded 
          7:  .p2align 1 
          8:  .type pass_padded,@function 
          9: pass_padded: 
         10:  sb a1, 0(a0) 
         11:  fsd fa0, 64(a0) 
         12:  ret 
         13: .Lfunc_end0: 
         14:  .size pass_padded, .Lfunc_end0-pass_padded 
         15:  
         16:  .section .text.ret_padded,"ax",@progbits 
         17:  .globl ret_padded 
         18:  .p2align 1 
         19:  .type ret_padded,@function 
         20: ret_padded: 
         21:  fld fa0, 64(a0) 
         22:  lbu a0, 0(a0) 
         23:  ret 
         24: .Lfunc_end1: 
         25:  .size ret_padded, .Lfunc_end1-ret_padded 
         26:  
         27:  .section .text.call_padded,"ax",@progbits 
         28:  .globl call_padded 
         29:  .p2align 1 
         30:  .type call_padded,@function 
         31: call_padded: 
         32:  fld fa0, 64(a0) 
         33:  lbu a0, 0(a0) 
         34:  tail take_padded 
         35: .Lfunc_end2: 
         36:  .size call_padded, .Lfunc_end2-call_padded 
         37:  
         38:  .section .text.receive_padded,"ax",@progbits 
         39:  .globl receive_padded 
         40:  .p2align 1 
         41:  .type receive_padded,@function 
         42: receive_padded: 
         43:  addi sp, sp, -16 
         44:  sd ra, 8(sp) 
         45:  sd s0, 0(sp) 
         46:  mv s0, a0 
         47:  call get_padded 
         48:  sb a0, 0(s0) 
         49:  fsd fa0, 64(s0) 
         50:  ld ra, 8(sp) 
         51:  ld s0, 0(sp) 
         52:  addi sp, sp, 16 
         53:  ret 
         54: .Lfunc_end3: 
         55:  .size receive_padded, .Lfunc_end3-receive_padded 
         56:  
         57:  .section .text.pass_packed,"ax",@progbits 
         58:  .globl pass_packed 
         59:  .p2align 1 
         60:  .type pass_packed,@function 
         61: pass_packed: 
         62:  addi sp, sp, -16 
         63:  sb a1, 0(a0) 
         64:  fsw fa0, 8(sp) 
         65:  lw a1, 8(sp) 
         66:  sb a1, 1(a0) 
         67:  srli a2, a1, 24 
next:87       !~~~~~~~~~~~~~~  error: match on wrong line
         68:  sb a2, 4(a0) 
         69:  srli a2, a1, 16 
         70:  sb a2, 3(a0) 
         71:  srli a1, a1, 8 
         72:  sb a1, 2(a0) 
         73:  addi sp, sp, 16 
         74:  ret 
         75: .Lfunc_end4: 
         76:  .size pass_packed, .Lfunc_end4-pass_packed 
         77:  
         78:  .section .text.ret_packed,"ax",@progbits 
         79:  .globl ret_packed 
         80:  .p2align 1 
         81:  .type ret_packed,@function 
         82: ret_packed: 
         83:  addi sp, sp, -16 
         84:  lbu a1, 2(a0) 
         85:  lbu a2, 1(a0) 
         86:  lbu a3, 3(a0) 
         87:  lbu a4, 4(a0) 
         88:  slli a1, a1, 8 
         89:  or a1, a1, a2 
         90:  slli a3, a3, 16 
         91:  slli a4, a4, 24 
         92:  or a3, a3, a4 
         93:  or a1, a1, a3 
         94:  sw a1, 8(sp) 
         95:  flw fa0, 8(sp) 
         96:  lbu a0, 0(a0) 
         97:  addi sp, sp, 16 
         98:  ret 
         99: .Lfunc_end5: 
        100:  .size ret_packed, .Lfunc_end5-ret_packed 
        101:  
        102:  .section .text.call_packed,"ax",@progbits 
        103:  .globl call_packed 
        104:  .p2align 1 
        105:  .type call_packed,@function 
        106: call_packed: 
        107:  addi sp, sp, -16 
        108:  lbu a1, 2(a0) 
        109:  lbu a2, 1(a0) 
        110:  lbu a3, 3(a0) 
        111:  lbu a4, 4(a0) 
        112:  slli a1, a1, 8 
        113:  or a1, a1, a2 
        114:  slli a3, a3, 16 
        115:  slli a4, a4, 24 
        116:  or a3, a3, a4 
        117:  or a1, a1, a3 
        118:  sw a1, 8(sp) 
        119:  flw fa0, 8(sp) 
        120:  lbu a0, 0(a0) 
        121:  addi sp, sp, 16 
        122:  tail take_packed 
        123: .Lfunc_end6: 
        124:  .size call_packed, .Lfunc_end6-call_packed 
        125:  
        126:  .section .text.receive_packed,"ax",@progbits 
        127:  .globl receive_packed 
        128:  .p2align 1 
        129:  .type receive_packed,@function 
        130: receive_packed: 
        131:  addi sp, sp, -32 
        132:  sd ra, 24(sp) 
        133:  sd s0, 16(sp) 
        134:  mv s0, a0 
        135:  call get_packed 
        136:  sb a0, 0(s0) 
        137:  fsw fa0, 8(sp) 
        138:  lw a0, 8(sp) 
        139:  sb a0, 1(s0) 
        140:  srli a1, a0, 24 
next:154      !~~~~~~~~~~~~~~  error: match on wrong line
        141:  sb a1, 4(s0) 
        142:  srli a1, a0, 16 
        143:  sb a1, 3(s0) 
        144:  srli a0, a0, 8 
        145:  sb a0, 2(s0) 
        146:  ld ra, 24(sp) 
        147:  ld s0, 16(sp) 
        148:  addi sp, sp, 32 
        149:  ret 
        150: .Lfunc_end7: 
        151:  .size receive_packed, .Lfunc_end7-receive_packed 
        152:  
        153:  .ident "rustc version 1.88.0-nightly (16bc686ef 2025-04-03)" 
        154:  .section ".note.GNU-stack","",@progbits 
>>>>>>
------------------------------------------



rust-log-analyzer avatar Apr 03 '25 23:04 rust-log-analyzer

Ping reviewer @workingjubilee

beetrees avatar May 25 '25 19:05 beetrees

@rustbot author

workingjubilee avatar Jun 03 '25 23:06 workingjubilee

Reminder, once the PR becomes ready for a review, use @rustbot ready.

rustbot avatar Jun 03 '25 23:06 rustbot

:warning: Warning :warning:

rustbot avatar Jun 10 '25 11:06 rustbot

(I had to rebase to fix a merge conflict.)

@rustbot ready

beetrees avatar Jun 10 '25 11:06 beetrees

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_codegen_gcc v0.1.0 (/checkout/compiler/rustc_codegen_gcc)
error[E0061]: this function takes 5 arguments but 4 arguments were supplied
    --> compiler/rustc_codegen_gcc/src/intrinsic/mod.rs:629:17
     |
629  |                 rustc_codegen_ssa::mir::store_cast(bx, cast, llscratch, scratch_align);
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                      ------------- argument #4 of type `RValue<'gcc>` is missing
     |
note: function defined here
    --> /checkout/compiler/rustc_codegen_ssa/src/mir/block.rs:1994:8
     |
1994 | pub fn store_cast<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     |        ^^^^^^^^^^
help: provide the argument
     |
629  |                 rustc_codegen_ssa::mir::store_cast(bx, cast, llscratch, /* RValue<'gcc> */, scratch_align);
     |                                                                         +++++++++++++++++++

For more information about this error, try `rustc --explain E0061`.
[RUSTC-TIMING] rustc_codegen_gcc test:false 3.520
error: could not compile `rustc_codegen_gcc` (lib) due to 1 previous error

rust-log-analyzer avatar Jun 10 '25 12:06 rust-log-analyzer

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [assembly] tests/assembly/riscv-float-struct-abi.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-19/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s" "/checkout/tests/assembly/riscv-float-struct-abi.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/assembly/riscv-float-struct-abi.rs:76:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: .cfi_restore ra
                ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:61:14: note: scanning from here
 ld s0, 0(sp)
             ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:66:2: note: possible intended match here
 .cfi_endproc
 ^
/checkout/tests/assembly/riscv-float-struct-abi.rs:102:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: .cfi_def_cfa_offset 0
                ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:86:17: note: scanning from here
 addi sp, sp, 16
                ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:90:2: note: possible intended match here
 .cfi_endproc
 ^
/checkout/tests/assembly/riscv-float-struct-abi.rs:126:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: .cfi_def_cfa_offset 0
                ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:113:17: note: scanning from here
 addi sp, sp, 16
                ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s:126:2: note: possible intended match here
 .cfi_def_cfa_offset 16
 ^

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/assembly/riscv-float-struct-abi/riscv-float-struct-abi.s
Check file: /checkout/tests/assembly/riscv-float-struct-abi.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1:  .text 
            2:  .attribute 4, 16 
            3:  .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0_zmmul1p0" 
            4:  .file "riscv_float_struct_abi.2ae10ca39861278-cgu.0" 
            5:  .section .text.pass_padded,"ax",@progbits 
            6:  .globl pass_padded 
            7:  .p2align 1 
            8:  .type pass_padded,@function 
            9: pass_padded: 
           10:  .cfi_startproc 
           11:  sb a1, 0(a0) 
           12:  fsd fa0, 64(a0) 
           13:  ret 
           14: .Lfunc_end0: 
           15:  .size pass_padded, .Lfunc_end0-pass_padded 
           16:  .cfi_endproc 
           17:  
           18:  .section .text.ret_padded,"ax",@progbits 
           19:  .globl ret_padded 
           20:  .p2align 1 
           21:  .type ret_padded,@function 
           22: ret_padded: 
           23:  .cfi_startproc 
           24:  fld fa0, 64(a0) 
           25:  lbu a0, 0(a0) 
           26:  ret 
           27: .Lfunc_end1: 
           28:  .size ret_padded, .Lfunc_end1-ret_padded 
           29:  .cfi_endproc 
           30:  
           31:  .section .text.call_padded,"ax",@progbits 
           32:  .globl call_padded 
           33:  .p2align 1 
           34:  .type call_padded,@function 
           35: call_padded: 
           36:  .cfi_startproc 
           37:  fld fa0, 64(a0) 
           38:  lbu a0, 0(a0) 
           39:  tail take_padded 
           40: .Lfunc_end2: 
           41:  .size call_padded, .Lfunc_end2-call_padded 
           42:  .cfi_endproc 
           43:  
           44:  .section .text.receive_padded,"ax",@progbits 
           45:  .globl receive_padded 
           46:  .p2align 1 
           47:  .type receive_padded,@function 
           48: receive_padded: 
           49:  .cfi_startproc 
           50:  addi sp, sp, -16 
           51:  .cfi_def_cfa_offset 16 
           52:  sd ra, 8(sp) 
           53:  sd s0, 0(sp) 
           54:  .cfi_offset ra, -8 
           55:  .cfi_offset s0, -16 
           56:  mv s0, a0 
           57:  call get_padded 
           58:  sb a0, 0(s0) 
           59:  fsd fa0, 64(s0) 
           60:  ld ra, 8(sp) 
           61:  ld s0, 0(sp) 
next:76'0                   X error: no match found
           62:  addi sp, sp, 16 
next:76'0      ~~~~~~~~~~~~~~~~~
           63:  ret 
next:76'0      ~~~~~
           64: .Lfunc_end3: 
next:76'0      ~~~~~~~~~~~~~
           65:  .size receive_padded, .Lfunc_end3-receive_padded 
next:76'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           66:  .cfi_endproc 
next:76'0      ~~~~~~~~~~~~~~
next:76'1       ?             possible intended match
           67:  
next:76'0      ~
           68:  .section .text.pass_packed,"ax",@progbits 
next:76'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
           69:  .globl pass_packed 
           70:  .p2align 1 
           71:  .type pass_packed,@function 
           72: pass_packed: 
           73:  .cfi_startproc 
           74:  addi sp, sp, -16 
           75:  .cfi_def_cfa_offset 16 
           76:  sb a1, 0(a0) 
           77:  fsw fa0, 8(sp) 
           78:  lw a1, 8(sp) 
           79:  sb a1, 1(a0) 
           80:  srli a2, a1, 24 
           81:  sb a2, 4(a0) 
           82:  srli a2, a1, 16 
           83:  sb a2, 3(a0) 
           84:  srli a1, a1, 8 
           85:  sb a1, 2(a0) 
           86:  addi sp, sp, 16 
next:102'0                     X error: no match found
           87:  ret 
next:102'0     ~~~~~
           88: .Lfunc_end4: 
next:102'0     ~~~~~~~~~~~~~
           89:  .size pass_packed, .Lfunc_end4-pass_packed 
next:102'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           90:  .cfi_endproc 
next:102'0     ~~~~~~~~~~~~~~
next:102'1      ?             possible intended match
           91:  
next:102'0     ~
           92:  .section .text.ret_packed,"ax",@progbits 
next:102'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           93:  .globl ret_packed 
           94:  .p2align 1 
           95:  .type ret_packed,@function 
           96: ret_packed: 
           97:  .cfi_startproc 
           98:  addi sp, sp, -16 
           99:  .cfi_def_cfa_offset 16 
          100:  lbu a1, 2(a0) 
          101:  lbu a2, 1(a0) 
          102:  lbu a3, 3(a0) 
          103:  lbu a4, 4(a0) 
          104:  slli a1, a1, 8 
          105:  or a1, a1, a2 
          106:  slli a3, a3, 16 
          107:  slli a4, a4, 24 
          108:  or a3, a3, a4 
          109:  or a1, a1, a3 
          110:  sw a1, 8(sp) 
          111:  flw fa0, 8(sp) 
          112:  lbu a0, 0(a0) 
          113:  addi sp, sp, 16 
next:126'0                     X error: no match found
          114:  ret 
next:126'0     ~~~~~
          115: .Lfunc_end5: 
next:126'0     ~~~~~~~~~~~~~
          116:  .size ret_packed, .Lfunc_end5-ret_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          117:  .cfi_endproc 
next:126'0     ~~~~~~~~~~~~~~
          118:  
next:126'0     ~
          119:  .section .text.call_packed,"ax",@progbits 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          120:  .globl call_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~~~
          121:  .p2align 1 
next:126'0     ~~~~~~~~~~~~
          122:  .type call_packed,@function 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          123: call_packed: 
next:126'0     ~~~~~~~~~~~~~
          124:  .cfi_startproc 
next:126'0     ~~~~~~~~~~~~~~~~
          125:  addi sp, sp, -16 
next:126'0     ~~~~~~~~~~~~~~~~~~
          126:  .cfi_def_cfa_offset 16 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~
next:126'1      ?                       possible intended match
          127:  lbu a1, 2(a0) 
next:126'0     ~~~~~~~~~~~~~~~
          128:  lbu a2, 1(a0) 
next:126'0     ~~~~~~~~~~~~~~~
          129:  lbu a3, 3(a0) 
next:126'0     ~~~~~~~~~~~~~~~
          130:  lbu a4, 4(a0) 
next:126'0     ~~~~~~~~~~~~~~~
          131:  slli a1, a1, 8 
next:126'0     ~~~~~~~~~~~~~~~~
          132:  or a1, a1, a2 
next:126'0     ~~~~~~~~~~~~~~~
          133:  slli a3, a3, 16 
next:126'0     ~~~~~~~~~~~~~~~~~
          134:  slli a4, a4, 24 
next:126'0     ~~~~~~~~~~~~~~~~~
          135:  or a3, a3, a4 
next:126'0     ~~~~~~~~~~~~~~~
          136:  or a1, a1, a3 
next:126'0     ~~~~~~~~~~~~~~~
          137:  sw a1, 8(sp) 
next:126'0     ~~~~~~~~~~~~~~
          138:  flw fa0, 8(sp) 
next:126'0     ~~~~~~~~~~~~~~~~
          139:  lbu a0, 0(a0) 
next:126'0     ~~~~~~~~~~~~~~~
          140:  addi sp, sp, 16 
next:126'0     ~~~~~~~~~~~~~~~~~
          141:  tail take_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~
          142: .Lfunc_end6: 
next:126'0     ~~~~~~~~~~~~~
          143:  .size call_packed, .Lfunc_end6-call_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          144:  .cfi_endproc 
next:126'0     ~~~~~~~~~~~~~~
          145:  
next:126'0     ~
          146:  .section .text.receive_packed,"ax",@progbits 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          147:  .globl receive_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~
          148:  .p2align 1 
next:126'0     ~~~~~~~~~~~~
          149:  .type receive_packed,@function 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          150: receive_packed: 
next:126'0     ~~~~~~~~~~~~~~~~
          151:  .cfi_startproc 
next:126'0     ~~~~~~~~~~~~~~~~
          152:  addi sp, sp, -32 
next:126'0     ~~~~~~~~~~~~~~~~~~
          153:  .cfi_def_cfa_offset 32 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~
          154:  sd ra, 24(sp) 
next:126'0     ~~~~~~~~~~~~~~~
          155:  sd s0, 16(sp) 
next:126'0     ~~~~~~~~~~~~~~~
          156:  .cfi_offset ra, -8 
next:126'0     ~~~~~~~~~~~~~~~~~~~~
          157:  .cfi_offset s0, -16 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~
          158:  mv s0, a0 
next:126'0     ~~~~~~~~~~~
          159:  call get_packed 
next:126'0     ~~~~~~~~~~~~~~~~~
          160:  sb a0, 0(s0) 
next:126'0     ~~~~~~~~~~~~~~
          161:  fsw fa0, 8(sp) 
next:126'0     ~~~~~~~~~~~~~~~~
          162:  lw a0, 8(sp) 
next:126'0     ~~~~~~~~~~~~~~
          163:  sb a0, 1(s0) 
next:126'0     ~~~~~~~~~~~~~~
          164:  srli a1, a0, 24 
next:126'0     ~~~~~~~~~~~~~~~~~
          165:  sb a1, 4(s0) 
next:126'0     ~~~~~~~~~~~~~~
          166:  srli a1, a0, 16 
next:126'0     ~~~~~~~~~~~~~~~~~
          167:  sb a1, 3(s0) 
next:126'0     ~~~~~~~~~~~~~~
          168:  srli a0, a0, 8 
next:126'0     ~~~~~~~~~~~~~~~~
          169:  sb a0, 2(s0) 
next:126'0     ~~~~~~~~~~~~~~
          170:  ld ra, 24(sp) 
next:126'0     ~~~~~~~~~~~~~~~
          171:  ld s0, 16(sp) 
next:126'0     ~~~~~~~~~~~~~~~
          172:  addi sp, sp, 32 
next:126'0     ~~~~~~~~~~~~~~~~~
          173:  ret 
next:126'0     ~~~~~
          174: .Lfunc_end7: 
next:126'0     ~~~~~~~~~~~~~
          175:  .size receive_packed, .Lfunc_end7-receive_packed 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          176:  .cfi_endproc 
next:126'0     ~~~~~~~~~~~~~~
          177:  
next:126'0     ~
          178:  .ident "rustc version 1.89.0-nightly (d9d9fdf01 2025-06-10)" 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          179:  .section ".note.GNU-stack","",@progbits 
next:126'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
------------------------------------------



rust-log-analyzer avatar Jun 10 '25 14:06 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #142550) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 16 '25 04:06 bors

r=me once you fix the merge conflicts again (sorry about that!)

@bors delegate+

workingjubilee avatar Jun 16 '25 07:06 workingjubilee

:v: @beetrees, you can now approve this pull request!

If @workingjubilee told you to "r=me" after making some further change, please make that change, then do @bors r=@workingjubilee

bors avatar Jun 16 '25 07:06 bors

@bors r=@workingjubilee

beetrees avatar Jun 16 '25 10:06 beetrees

:pushpin: Commit 5723c9997c41be799fcaec791e591fb8406421ff has been approved by workingjubilee

It is now in the queue for this repository.

bors avatar Jun 16 '25 10:06 bors