You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "ENJOU1224 (via GitHub)" <gi...@apache.org> on 2026/01/04 13:30:31 UTC

[PR] arch/risc-v: Fix incompatible pointer types in vector context switching [nuttx]

ENJOU1224 opened a new pull request, #17762:
URL: https://github.com/apache/nuttx/pull/17762

   ## Summary
   
   The `riscv_savevpu`, `riscv_restorevpu`, and `riscv_vpuregs` functions were using `uintptr_t *` for vector registers, but `tcb->xcp.vregs` is defined as `uintreg_t *`. This mismatch caused compilation errors on newer GCC versions (e.g., GCC 13+) due to incompatible pointer types. This patch aligns the parameter types to `uintreg_t *` to match the structure definition.
   
   ## Impact
   
   **Build:** Fixes compilation warnings/errors on GCC 13+ toolchains regarding incompatible pointer types.
   **Hardware:** RISC-V architectures with Vector extension enabled.
    **Compatibility:** No functional change in runtime behavior (since `uintptr_t` and `uintreg_t` usually have the same width on RV32/RV64), but ensures source-level type safety.
   
   ## Testing
   
   **Host Environment:**
   *   **OS:** Ubuntu 25.10 (Linux 6.17.0-8-generic)
   *   **Compiler:** riscv64-unknown-elf-gcc (14.2.0+19) 14.2.0
   *   **QEMU:** QEMU emulator version 10.1.50 (v10.1.0-1314-gf3f2ad1193)
   
   **Verification Steps:**
   
   1.  **Compilation Fix verification:**
       *   **Target:** `rv-virt:nsh` (Modified to enable Vector extension)
       *  **Command:** `make -j`
       *   **Before check:** Build fails with `error: passing argument 1 of 'riscv_savevpu' from incompatible pointer type` on GCC 14.2.0.
       *   **After check:** Build completes successfully without "incompatible pointer type" errors.
   
   
   2.  **Runtime Verification:**
       Booted the image on QEMU to ensure no regression in context switching initialization.
   
       Command:
       ```bash
       qemu-system-riscv32 \
             -nographic \
             -M virt \
             -bios none \
             -kernel ./nuttx \
             -cpu max,vlen=256,elen=64,v=true
       ```
   
       **Boot Log:**
       ```text
       ABC
       NuttShell (NSH) NuttX-12.12.0
       nsh> 
       ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] arch/risc-v: Fix incompatible pointer types in vector context switching [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #17762:
URL: https://github.com/apache/nuttx/pull/17762


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org