aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr113596.c
blob: 376268506285e8e63a6e8f64fd98b87416ce9fc2 (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
33
34
35
36
37
/* PR middle-end/113596 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-einline" } */
/* { dg-final { scan-tree-dump-times "__builtin_stack_save \\\(" 3 "einline" } } */
/* { dg-final { scan-tree-dump-times "__builtin_stack_restore \\\(" 3 "einline" } } */

void baz (char *p, int n);
volatile int v;

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

static inline __attribute__((always_inline)) void
bar (int n)
{
  ++v;
  {
    char p[n];
    baz (p, n);
  }
  ++v;
}

void
qux (int n)
{
  foo (n);
  bar (n);
}