[PATCH] newlib: libm: Fix RISCV feraiseexcept return value when success

William Tsai william.tsai@sifive.com
Thu Oct 24 07:26:46 GMT 2024


According to the document, feraiseexcept should return 0 when exception
is raised succesfully. The return statement is missing here causing it
always return a non-zero value even when success.
---
 newlib/libm/machine/riscv/feraiseexcept.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/newlib/libm/machine/riscv/feraiseexcept.c b/newlib/libm/machine/riscv/feraiseexcept.c
index 817fa6274..99bacd556 100644
--- a/newlib/libm/machine/riscv/feraiseexcept.c
+++ b/newlib/libm/machine/riscv/feraiseexcept.c
@@ -64,6 +64,7 @@ int feraiseexcept(int excepts)
   /* Set the requested exception flags */
 
   asm volatile("csrs fflags, %0" : : "r"(excepts));
+  return 0;
 
   /* Per 'feraiseexcept.html:
    * "If the argument is zero or if all the specified exceptions were
-- 
2.37.1



More information about the Newlib mailing list