diff options
author | Ruinland ChuanTzu Tsai <ruinland@andestech.com> | 2019-12-02 19:06:52 +0800 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-12-07 12:58:39 -0500 |
commit | c0b4a7b25430e4495bb213a5c3ad43e26c6bff20 (patch) | |
tree | 8d86fcc16b0479db29ccf5ad1e734c5901d3e4fe /src/fenv/riscv64/fenv.S | |
parent | daa29e894c74d61296fe19d9b7c4be2f04037639 (diff) | |
download | musl-c0b4a7b25430e4495bb213a5c3ad43e26c6bff20.tar.gz musl-c0b4a7b25430e4495bb213a5c3ad43e26c6bff20.tar.bz2 musl-c0b4a7b25430e4495bb213a5c3ad43e26c6bff20.tar.xz musl-c0b4a7b25430e4495bb213a5c3ad43e26c6bff20.zip |
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.
Diffstat (limited to 'src/fenv/riscv64/fenv.S')
-rw-r--r-- | src/fenv/riscv64/fenv.S | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fenv/riscv64/fenv.S b/src/fenv/riscv64/fenv.S index f149003d..0ea78bf9 100644 --- a/src/fenv/riscv64/fenv.S +++ b/src/fenv/riscv64/fenv.S @@ -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 |