Re: [PATCH 1/4] alpha: add the denormal trap enable bit to FE_NOMASK_ENV

Adhemerval Zanella Netto <[email protected]> Tue, 4 Aug 2026 09:49:35 -0300
Newsgroups gmane.comp.lib.glibc.alpha
Organization Linaro
Message-ID <[email protected]>

On 03/08/26 20:55, Matt Turner wrote:
> FE_NOMASK_ENV is the floating-point environment in which no exception is
> masked, so it must enable every exception that FE_ALL_EXCEPT covers.  On
> Alpha that includes the GNU extension FE_DENORMAL, whose SWCR trap enable
> bit is IEEE_TRAP_ENABLE_DNO (bit 6).
> 
> The constant only set bits 1 through 5 (INV, DZE, OVF, UNF and INE), so
> after fesetenv (FE_NOMASK_ENV) a subsequent fegetexcept () returned
> 0x3e0000 rather than FE_ALL_EXCEPT (0x7e0000), and denormal exceptions
> stayed masked.  Set bit 6 as well.
> 
> Fixes math/test-fenv-return on alpha.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <[email protected]>

> ---
>  sysdeps/alpha/fpu/bits/fenv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git ./sysdeps/alpha/fpu/bits/fenv.h ./sysdeps/alpha/fpu/bits/fenv.h
> index b1135f1f0a..530f298914 100644
> --- ./sysdeps/alpha/fpu/bits/fenv.h
> +++ ./sysdeps/alpha/fpu/bits/fenv.h
> @@ -121,7 +121,7 @@ typedef unsigned long int fenv_t;
>  
>  #ifdef __USE_GNU
>  /* Floating-point environment where none of the exceptions are masked.  */
> -# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000003eUL)
> +# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000007eUL)
>  
>  /* Floating-point environment with (processor-dependent) non-IEEE floating
>     point.  In this case, mapping denormals to zero.  */