Skip to content

Commit 608e705

Browse files
committed
sh: Check for invalidate argument to fesetround
This function needs to return an error for invalid argument and not change the rounding mode. Signed-off-by: Keith Packard <[email protected]>
1 parent b3ea5b3 commit 608e705

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

newlib/libc/machine/sh/machine/fenv-fp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ __declare_fenv_inline(int) fesetround(int round)
148148
{
149149
fenv_t fpscr;
150150

151+
if (round & ~_SH_FPU_ROUND_MASK)
152+
return (1);
151153
_sh_get_fpscr(fpscr);
152154
fpscr &= ~(_SH_FPU_ROUND_MASK);
153155
fpscr |= round;

0 commit comments

Comments
 (0)