1 /* Demonstrate Memcheck correctly handling a 64M array on the stack.
2    Requires --max-stackframe=67108884 or above.  And since it
3    generates a very large stack, --main-stacksize=67200000
4    (approximately) is also required. */
5 
6 #include <stdio.h>
7 
8 #define N_MBYTES 64
9 #define N_INTS ((N_MBYTES * 1048576) / sizeof(int))
10 
main(void)11 int main(void)
12 {
13    int i, sum;
14    int arr[N_INTS];
15    printf("lsframe1: start\n");
16    for (i = 0; i < N_INTS; i++)
17       arr[i] = i;
18    sum = 0;
19    for (i = 0; i < N_INTS; i++)
20       sum += arr[i];
21    printf("lsframe1: done, result is %d\n", sum);
22    return 0;
23 }
24