arch/risc-v: Fix incompatible pointer types in vector context switching #17762
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The
riscv_savevpu,riscv_restorevpu, andriscv_vpuregsfunctions were usinguintptr_t *for vector registers, buttcb->xcp.vregsis defined asuintreg_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 touintreg_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_tanduintreg_tusually have the same width on RV32/RV64), but ensures source-level type safety.Testing
Host Environment:
Verification Steps:
Compilation Fix verification:
rv-virt:nsh(Modified to enable Vector extension)make -jerror: passing argument 1 of 'riscv_savevpu' from incompatible pointer typeon GCC 14.2.0.Runtime Verification:
Booted the image on QEMU to ensure no regression in context switching initialization.
Command:
qemu-system-riscv32 \ -nographic \ -M virt \ -bios none \ -kernel ./nuttx \ -cpu max,vlen=256,elen=64,v=trueBoot Log: