aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c
blob: 520cad0b2098c78f26b61609b723e840dc29b26f (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
38
39
40
41
/* It seems there is no way to avoid the other source of mulitple
   source testcase from being compiled independently.  Just avoid
   error.  */
/* { dg-require-effective-target lto } */
#ifdef DOJOB
extern int a;
void abort (void);

#ifdef _PROFILE_USE
__attribute__ ((externally_visible))
int constval=1,constval2=2;
#else
__attribute__ ((externally_visible))
int constval=3,constval2=2;
#endif


void
add(int i)
{
  /* Verify that inlining happens for first case.  */
  if (i==constval && !__builtin_constant_p (i))
    abort ();
  /* Second case has no dominating target; it should not inline.  */
  if (i==constval2 && __builtin_constant_p (i))
    abort ();
  a += i;
}
void
sub(int i)
{
  a -= i;
}
__attribute__ ((externally_visible))
void (*p[2])(int)={add, sub};
#else
main()
{
  return 0;
}
#endif