Re: [PATCH] Fix ARM fegetexceptflag.c

"Richard Earnshaw (lists)" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On 16/10/2025 23:08, Matt Reynolds wrote:
> The ARM fegetexceptflag() implementation was accidentally replaced with
> fesetexceptflag() during refactoring in 3ca43259686187e081d317e2b406724a849c9d7b.
> Restore the original implementation.
> 
> Tested on Cortex-M7.
> ---
>  newlib/libm/machine/arm/fegetexceptflag.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/newlib/libm/machine/arm/fegetexceptflag.c b/newlib/libm/machine/arm/fegetexceptflag.c
> index 2bfcb08ae..17b3a3d7d 100644
> --- a/newlib/libm/machine/arm/fegetexceptflag.c
> +++ b/newlib/libm/machine/arm/fegetexceptflag.c
> @@ -37,9 +37,7 @@ int fegetexceptflag(fexcept_t *flagp, int excepts)
>  	fexcept_t __fpsr;
>  
>  	vmrs_fpscr(__fpsr);
> -	__fpsr &= ~excepts;
> -	__fpsr |= *flagp & excepts;
> -	vmsr_fpscr(__fpsr);
> +	*flagp = __fpsr & excepts;
>  #endif
>  	return (0);
>  }

Actually, I think the bug was introduced in b7a6e02dc6a5289bfa489c0e7b6539abd281e2c6.  I've adjusted the commit message and pushed.

Thanks for fixing it.

R.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.