https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112855
Patrick O'Neill <patrick at rivosinc dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[14] RISC-V vector: Appears |[14] RISC-V vector: |to be overwriting stack arg |vsetivli clobbers variable | |value --- Comment #1 from Patrick O'Neill <patrick at rivosinc dot com> --- lw a5,%lo(b)(a3) load the value of b (100) into a5 vsetivli a5,5,e32,m1,ta,ma clobbers the a5 regsiter which previously held b addiw a1,a5,1 a5 is treated as b (this is the b++ statement) sw a1,%lo(b)(a3) and a1 (a5+1) is stored to b. It appears like the compiler doesn't realize that vsetivli clobbers a5.