modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/20031012-1.c (about) 1 /* { dg-add-options stack_size } */ 2 3 /* PR optimization/8750 4 Used to fail under Cygwin with 5 -O2 -fomit-frame-pointer 6 Testcase by David B. Trout */ 7 8 #if defined(STACK_SIZE) && STACK_SIZE < 16000 9 #define ARRAY_SIZE (STACK_SIZE / 2) 10 #define STRLEN (ARRAY_SIZE - 9) 11 #else 12 #define ARRAY_SIZE 15000 13 #define STRLEN 13371 14 #endif 15 16 extern void *memset (void *, int, __SIZE_TYPE__); 17 extern void abort (void); 18 19 static void foo () 20 { 21 char a[ARRAY_SIZE]; 22 23 a[0]=0; 24 memset( &a[0], 0xCD, STRLEN ); 25 a[STRLEN]=0; 26 if (strlen(a) != STRLEN) 27 abort (); 28 } 29 30 int main ( int argc, char* argv[] ) 31 { 32 foo(); 33 return 0; 34 }