scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

0001-abort.c (307B)


      1 #include <assert.h>
      2 #include <stdio.h>
      3 #include <signal.h>
      4 #include <stdlib.h>
      5 
      6 /*
      7 output:
      8 aborting
      9 end:
     10 */
     11 
     12 int ret = 1;
     13 
     14 void
     15 handler(int dummy)
     16 {
     17 	_Exit(ret);
     18 }
     19 
     20 int
     21 main(void)
     22 {
     23 	printf("aborting\n");
     24 	assert(signal(SIGABRT, handler) != SIG_ERR);
     25 	ret = 0;
     26 	abort();
     27 	printf("borning\n");
     28 
     29 	return 1;
     30 }