[PATCH] LoongArch: fix missing trap for enabled exceptions on narrowing operation

Xi Ruoyao xry111@xry111.site
Thu Mar 19 10:21:20 GMT 2026


On Thu, 2026-03-19 at 10:14 +0100, Florian Weimer wrote:
> * Xi Ruoyao:
> 
> > diff --git a/math/test-narrowing-trap.c b/math/test-narrowing-trap.c
> > new file mode 100644
> > index 0000000000..110ac15f62
> 
> > +  if (!EXCEPTION_ENABLE_SUPPORTED (FE_INVALID))
> > +    {
> > +      puts ("feenableexcept (FE_INVALID) not supported, cannot test.");
> > +      return 77;
> > +    }
> 
> You can use FAIL_UNSUPPORTED from <support/check.h>.
> 
> > +  pid = fork ();
> > +  if (pid == 0)
> > +    {
> > +#ifdef RLIMIT_CORE
> > +      /* Try to avoid dumping core.  */
> > +      struct rlimit core_limit = {};
> > +      setrlimit (RLIMIT_CORE, &core_limit);
> > +#endif
> 
> The test framework (<support/test-driver.c>) deals with that.
> 
> We also have error-checking variants xfork, xwaitpid, and TEST_VERIFY
> and TEST_COMPARE for checking specific conditions.

test-fenv.c uses fork() and check if it returns ENOSYS (if so it skips
the test).  Is doing so really necessary or may I just use xfork()
instead?

-- 
Xi Ruoyao <xry111@xry111.site>


More information about the Libc-alpha mailing list