summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
blob: e9dc434ece028dc869e646167be59b17338982b0 (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
/* { dg-do link } */
/* { dg-options "-O2" } */

extern void link_error (void) { /* XFAIL */ }

typedef unsigned char(*Calculable)(void);

static unsigned char one() { return 1; }
static unsigned char two() { return 2; }

static int
print(Calculable calculate)
{
  return calculate() + calculate() + 1;
}

int
main()
{
  /* Make sure we perform indirect inlining of one and two and optimize
     the result to a constant.  */
  if (print(one) != 3)
    link_error ();
  if (print(two) != 5)
    link_error ();
  return 0;
}