1 #include <stdio.h>
2 
big(void)3 __attribute__((noinline)) void big(void)
4 {
5    /* The below ensures the stack grows a lot. However, we hope the stack
6       extension is not done yet, as no memory has been read/written. */
7    volatile char c[200000];
8 
9    /* Access only the higher part of the stack, to avoid mapping SP */
10    /* The below 2 printfs should produce deterministic output, whatever
11       the random value of c[]. */
12    if (c[200000 - 1])
13       fprintf(stderr, "Accessing fresh %s\n", "stack");
14    else
15       fprintf(stderr, "Accessing %s stack\n", "fresh");
16 
17 }
18 
main(void)19 int main(void )
20 {
21    big();
22    return 0;
23 }
24