#2100: SIGFPE -----------------------------+---------------------------- Reporter: sebastian.huber | Owner: joel.sherrill Type: defect | Status: new Priority: normal | Milestone: 4.11 Component: cpukit | Version: HEAD Severity: normal | Resolution: Keywords: | -----------------------------+----------------------------
Old description: > 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. New description: 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. -- Comment (by joel.sherrill): What about the code in killinfo.c simply checking that it is inside an ISR before doing that test. What do you think Sebastian? -- Ticket URL: <http://devel.rtems.org/ticket/2100#comment:2> RTEMS Project <http://www.rtems.org/> RTEMS Project _______________________________________________ bugs mailing list bugs@rtems.org http://lists.rtems.org/mailman/listinfo/bugs