riscv64: fix fesetenv(FE_DFL_ENV) crash

When FE_DFL_ENV is passed to fesetenv(), the very first instruction
lw t1, 0(a0) will fail since a0 is -1.
This commit is contained in:
Ruinland ChuanTzu Tsai 2019-12-02 19:06:52 +08:00 committed by Rich Felker
parent daa29e894c
commit c0b4a7b254

View File

@ -45,8 +45,11 @@ fegetenv:
.global fesetenv
.type fesetenv, %function
fesetenv:
li t2, -1
li t1, 0
beq a0, t2, 1f
lw t1, 0(a0)
fscsr t0, t1
1: fscsr t1
li a0, 0
ret