28 #pragma GCC diagnostic ignored "-Wdiv-by-zero" 30 void sighandler(
int sig)
32 printf(
"Happily ignoring signal %d\n", sig);
35 int main(
int argc,
char *argv[])
37 printf(
"crashtest: a return value of zero means success\n");
39 signal(SIGFPE, sighandler);
40 signal(SIGILL, sighandler);
43 printf(
"Testing SIGFPE...\n");
45 float b = 1.0f / 0.0f;
50 printf(
"Testing SIGILL...\n");
51 char badops[] = {0xab, 0xcd, 0xef, 0x12};
52 void (*f)() = (
void (*)()) badops;
56 printf(
"All signals handled.\n");