summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/iinline-3.c
blob: b39957162ab8ba839f3f09a532e1a4fff379f84b (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
/* Verify that call declarations are not redirected according to indirect
   inlining edges too early.  */
/* { dg-do run } */
/* { dg-options "-O3 -fno-early-inlining"  } */

extern void abort (void);

int bar (int k)
{
  return k+2;
}

int baz (int k)
{
  return k+1;
}

static int foo (int (*p)(int), int i)
{
  return p (i+1);
}

int (*g)(int) = baz;

int main (int argc, char *argv[])
{
  if (foo (bar, 0) != 3)
    abort ();
  if (foo (g, 1) != 3)
    abort ();

  return 0;
}