No, it’s correct.
According to the C standard, the result of shifting by more than the word size is undefined.
The RISC-V specification says that only the lowest 5 bits of the shift amount are used. In other words when you write “c = a >> b” the result is the same as if you wrote “c = a >> (b & 0x1f)”
You’ll get exactly the same results if you run your program on i386/i686 (32 bit x86).
ARM CPUs will give you the 0 result you seem to be looking for if you shift by 32 bits or more.
If you write your code as either “c = b < 32 ? a >> b : 0” or “c = a >> (b & 0x1f)” then you will avoid undefined behavior and get the same results on all CPU types. depending on which behavior you want.