/* * File chk_memset.c -- A test of memset() * * For some number N > 8, set the first N chars of a buffer * with a char > 0x7F (in an unsigned sense) * * Check whether unanticipated sign extension in the memset() * function has overwritten the first few chars of the buffer. * * Run the test using: * % cc compiler_options_of_your_choice chk_memset.c * % a.out * * Failures have been reported on * some SGI Irix 6.2 systems with cc -n32 chk_memset.c * */ #include #include #ifndef N #define N 100 #endif size_t n = N; signed char buf[N*2]; signed char set_char = -0x80; void assign ( signed char set_char ) { int i; for(i=0; i