aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
blob: a2777a604b9b8627f274d8124660f7c68ec78d32 (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);

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;
}