summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20031012-1.c
blob: 8c5ed276eb2e6e620b7725403295daf480acb208 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
   20031012-1.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* PR optimization/8750
   Used to fail under Cygwin with 
   -O2 -fomit-frame-pointer        
   Testcase by David B. Trout     */

#if defined(STACK_SIZE) && STACK_SIZE < 16000
#define ARRAY_SIZE (STACK_SIZE / 2)
#define STRLEN	   (ARRAY_SIZE - 9)
#else
#define ARRAY_SIZE 15000
#define STRLEN     13371
#endif

#include <string.h>

static void foo ()
{
#if !defined (__SDCC_gbz80) && !defined (__SDCC_mcs51) && !defined (__SDCC_stm8) && !defined (__SDCC_pdk14) && !defined (__SDCC_pdk15)
    char a[ARRAY_SIZE]; /* Too big for mcs51 and gbz80 and stm8 and pdk14. */
    a[0]=0;
    memset( &a[0], 0xCD, STRLEN );
    a[STRLEN]=0;
    if (strlen(a) != STRLEN)
      ASSERT (0);
#endif
}

void
testTortureExecute (void)
{
    foo();
    return;
}