// S : tags libc c // S : expect --result valid // S : cc -o test.bc -D_PDCLIB_BUILD -DTEST $file // S : verify -o nofail:malloc test.bc #include #include #include "_PDCLIB_test.h" #include static int flags[ 32 ]; static void counthandler( void ) { static int count = 0; flags[ count ] = count; ++count; } static void checkhandler( void ) { for ( int i = 0; i < 31; ++i ) { assert( flags[ i ] == i ); } } int main( void ) { TESTCASE( atexit( &checkhandler ) == 0 ); for ( int i = 0; i < 31; ++i ) { TESTCASE( atexit( &counthandler ) == 0 ); } return TEST_RESULTS; }