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