NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: misc/56820: Many FPE related tests fail on softfloat machines
The following reply was made to PR misc/56820; it has been noted by GNATS.
From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: misc/56820: Many FPE related tests fail on softfloat machines
Date: Thu, 5 Oct 2023 13:50:09 +0200
The patch below seems to work for me. Am I ovelooking some corner
cases?
Martin
Index: softfloat-specialize
===================================================================
RCS file: /cvsroot/src/lib/libc/softfloat/softfloat-specialize,v
retrieving revision 1.9
diff -u -p -r1.9 softfloat-specialize
--- softfloat-specialize 10 Aug 2014 05:57:31 -0000 1.9
+++ softfloat-specialize 5 Oct 2023 11:46:10 -0000
@@ -66,6 +66,8 @@ fp_except float_exception_mask = 0;
void
float_raise( fp_except flags )
{
+ struct sigaction sa;
+ sigset_t set;
siginfo_t info;
fp_except mask = float_exception_mask;
@@ -92,6 +94,26 @@ float_raise( fp_except flags )
info.si_code = FPE_FLTINV;
else if (flags & float_flag_inexact)
info.si_code = FPE_FLTRES;
+
+ /*
+ * Make sure SIGFPE is not blocked/ignored - that would be impossible
+ * with FP hardware.
+ */
+ sigemptyset(&set);
+ sigaddset(&set, SIGFPE);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
+ if (sigaction(SIGFPE, NULL, &sa) == 0) {
+ if (sa.sa_handler == SIG_IGN) {
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_DFL;
+ sigemptyset(&sa.sa_mask);
+ } else {
+ sa.sa_flags |= SA_RESETHAND;
+ }
+ sigaction(SIGFPE, &sa, NULL);
+ }
+
+ /* deliver the signal */
sigqueueinfo(getpid(), &info);
}
}
Home |
Main Index |
Thread Index |
Old Index