[PATCH] math: Fix unsupported check in test-narrowing-trap

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Jul 16 15:00:16 GMT 2026



On 16/07/26 11:01, Yury Khrustalev wrote:
> ---
> 
> Base commit: af51ed63d0
> 
> Test change only. Passes regression on aarch64-linux-gnu,
> x86_64-linux-gnu, i686-linux-gnu and build-tested for
> several targets with build-many-glibcs.py.
> 
> Andreas, I suppose we could merge this test fix now? It's OK if not.

Is this fix for loongarch? If so I think you can check with cfarm401
machine [1] (for some reason cfarm400 is not accepting my keys).

[1] https://portal.cfarm.net/machines/list/

> 
> ---
>  math/test-narrowing-trap.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/math/test-narrowing-trap.c b/math/test-narrowing-trap.c
> index 6d21357913..5820de42ad 100644
> --- a/math/test-narrowing-trap.c
> +++ b/math/test-narrowing-trap.c
> @@ -22,6 +22,7 @@
>  #include <stdlib.h>
>  #include <support/check.h>
>  #include <support/xunistd.h>
> +#include <support/test-driver.h>
>  
>  static int
>  do_test (void)
> @@ -29,14 +30,14 @@ do_test (void)
>  #ifdef FE_INVALID
>    pid_t pid;
>  
> -  if (!EXCEPTION_ENABLE_SUPPORTED (FE_INVALID))
> -    FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
> -
>    pid = xfork ();
>    if (pid == 0)
>      {
>        int r = feenableexcept (FE_INVALID);
>  
> +      if (!EXCEPTION_ENABLE_SUPPORTED (FE_INVALID) && r == -1)
> +        FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
> +
>        TEST_COMPARE (r, 0);
>        fdiv (0.0, 0.0);
>        _exit (0);
> @@ -46,6 +47,9 @@ do_test (void)
>        int status;
>        xwaitpid (pid, &status, 0);
>  
> +      if (WEXITSTATUS (status) == EXIT_UNSUPPORTED)
> +        FAIL_UNSUPPORTED ("feenableexcept (FE_INVALID) not supported");
> +
>        TEST_VERIFY (WIFSIGNALED (status));
>        TEST_COMPARE (WTERMSIG (status), SIGFPE);
>      }



More information about the Libc-alpha mailing list