* bug-div0.c: raise SIGFPE manually since Darwin won't trap on 1/0.

This commit is contained in:
Sam Hocevar
2008-07-20 10:19:06 +00:00
committed by sam
parent 3dd196f19f
commit 523675e3d9
+4
View File
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
int buf[1];
@@ -24,7 +25,10 @@ int main(void)
int ch;
while((ch = getc(stdin)) != EOF)
{
buf[0] = 1 / !ch;
if(ch) raise(SIGFPE); /* Needed on OS X... sigh. */
}
return EXIT_SUCCESS;
}