[PATCH] LoongArch: fix missing trap for enabled exceptions on narrowing operation
Florian Weimer
fweimer@redhat.com
Thu Mar 19 10:26:09 GMT 2026
* Xi Ruoyao:
> 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?
No, this is just a very, very old test. We don't support testing glibc
without a working fork.
Thanks,
Florian
More information about the Libc-alpha
mailing list