Opened on 03/26/13 at 11:55:57
Last modified on 08/14/17 at 00:39:21
#2100 new defect
SIGFPE
Reported by: | Sebastian Huber | Owned by: | Joel Sherrill |
---|---|---|---|
Priority: | low | Milestone: | Indefinite |
Component: | score | Version: | |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description (last modified by Sebastian Huber)
A GCC test uses the following mechanic:
#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>
void sigfpe(int signum)
{
exit(0);
}
int main()
{
signal(SIGFPE, sigfpe);
#ifdef rtems
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGFPE);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
#endif
raise(SIGFPE);
assert(0);
}
The parts in the defined(rtems) section are necessary in RTEMS to get a behaviour similar to Linux.
This is because RTEMS has a special treatment for some signals (in killinfo()):
/*
- P1003.1c/Draft 10, p. 33 says that certain signals should always
- be directed to the executing thread such as those caused by hardware
- faults. */
if ( (sig == SIGFPE) (sig == SIGILL) (sig == SIGSEGV ) ) return pthread_kill( pthread_self(), sig );
We should evaluate if this works as intended.
Change History (5)
comment:1 Changed on 03/26/13 at 14:58:19 by Joel Sherrill
comment:2 Changed on 11/23/14 at 16:25:30 by Joel Sherrill
Description: | modified (diff) |
---|
What about the code in killinfo.c simply checking that it is inside an ISR before doing that test. What do you think Sebastian?
comment:3 Changed on 11/24/14 at 18:58:28 by Gedare Bloom
Version: | HEAD → 4.11 |
---|
Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11
comment:4 Changed on 12/18/14 at 12:26:01 by Sebastian Huber
Description: | modified (diff) |
---|---|
Milestone: | 4.11 → 5.0 |
Priority: | normal → low |
comment:5 Changed on 08/14/17 at 00:39:21 by Chris Johns
Milestone: | 5.0 → Indefinite |
---|---|
Version: | 4.11 |
I can't tell from this example whether main() is a POSIX pthread or a Classic API task. If it is a Classic API task, all POSIX signals are masked since that tasks under that API no nothing about signals.
Assuming the BSP propagates a SIGFPE exception, if this is a pthread, then it should work.
I can't find the text that requires SIGFPE and other hardware originated signals to be directed at a thread. I found this in book:
http://books.google.com/books?id=_xvnuFzo7q0C&pg=PA216&lpg=PA216&dq=SIGFPE+thread&source=bl&ots=Kn3SYTY6Uf&sig=4tHRFIbJdjf2MVv98CuN8Y5hGuk&hl=en&sa=X&ei=-MRRUdSwIYSa9QT6pIGgDQ&ved=0CDAQ6AEwAA#v=onepage&q=SIGFPE%20thread&f=false
The question likely comes down to what the default signal mask should be for a task that is not a POSIX Thread.