From: Ruinland ChuanTzu Tsai Date: Mon, 2 Dec 2019 11:06:52 +0000 (+0800) Subject: riscv64: fix fesetenv(FE_DFL_ENV) crash X-Git-Tag: v1.2.0~57 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c0b4a7b25430e4495bb213a5c3ad43e26c6bff20;p=oweals%2Fmusl.git 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. --- 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