aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr113596.c
blob: 3655ffef3f976445e6042c9904c1bbe7516727d2 (plain)
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
/* PR middle-end/113596 */
/* { dg-do run } */
/* { dg-options "-O2" } */

__attribute__((noipa)) void
bar (char *p, int n)
{
  p[0] = 1;
  p[n - 1] = 2;
}

static inline __attribute__((always_inline)) void
foo (int n)
{
  char *p = __builtin_alloca (n);
  bar (p, n);
}

#if defined __AVR__
/* For AVR devices, AVRtest assigns 8 KiB of stack, which is not quite
   enough for this test case.  Thus request less memory on AVR.  */
#define ALLOC 6000
#else
#define ALLOC 8192
#endif

int
main ()
{
  for (int i = 2; i < ALLOC; ++i)
    foo (i);
}