/* * Signal / FP interaction test */ #include #include #include #include void do_alarm(int sig) { double i,j,k,l,m,n; i = 0.0f; j = 0.0f; k = 0.0f; l = 0.0f; m = 0.0f; n = 0.0f; } int main(int argc, char *argv[]) { struct itimerval t; double z; signal(SIGALRM, do_alarm); t.it_value.tv_sec = 0; /* This will be rounded up to the shortest interval. */ t.it_value.tv_usec = 1; z = 100.0f; printf("Starting.\n"); setitimer(ITIMER_REAL, &t, NULL); printf("Timer set.\n"); while (z == 100.0f) { __asm __volatile("xnop;"); } printf("Uh oh! Floating point comparison failed!\n"); return (0); }