On 1/24/25 3:12 PM, Vineet Gupta wrote:
RV-Vector FP-INT insns use the rounding mode in FRM register which if explicitly set for V insn needs, is saved/restored (although from the psABI CC Spec, it is not clear if it actually a caller-saved or callee-saved). Anyhow in the failure case the save/restore were generated by the Mode Switch pass, but then eliminated by sched1:DCE and Late-Combine. Fix this by using unspec_volatile variant which won't be eliminated. This showed up as SPEC2017 527.cam4 runtime aborts in glibc:round_away() which checks for standard rounding modes and the "leaking" rounding mode due to the bug happened to be a non-standard RISC-V specific RMM "Round to Nearest, ties to Max". This is testsuite clean:
Not sure how it could be clean as I think the test itself is busted ;-) As-is it'll trigger compile time failures:
FAIL: gfortran.target/riscv/rvv/pr118646.f90 -O0 (test for excess errors) Excess errors: /home/jlaw/test/gcc/gcc/testsuite/gfortran.target/riscv/rvv/pr118646.f90:18:12: Warning: Deleted feature: End expression in DO loop at (1) must be integer /home/jlaw/test/gcc/gcc/testsuite/gfortran.target/riscv/rvv/pr118646.f90:22:15: Warning: Deleted feature: End expression in DO loop at (1) must be integer /home/jlaw/test/gcc/gcc/testsuite/gfortran.target/riscv/rvv/pr118646.f90:36:18: Warning: Deleted feature: End expression in DO loop at (1) must be integer
A "-w" will work around that, but then there's no Fortran equivalent of main and we get a link error:
FAIL: gfortran.target/riscv/rvv/pr118646.f90 -O0 (test for excess errors) Excess errors: /release/linux/.build/src/glibc-git-4d29ec7c/csu/../sysdeps/riscv/start.S:67:(.text+0x22): undefined reference to `main' UNRESOLVED: gfortran.target/riscv/rvv/pr118646.f90 -O0 compilation failed to produce executable
What I wanted to do was use your testcase with Pan's patch to see if Pan's patch resolved both issues.
Your compiler patch may still be desirable as well, I really haven't really evaluated that yet.
jeff ps. Pre-commit also failed on the new test:
https://github.com/ewlu/gcc-precommit-ci/issues/3051#issuecomment-2613516130