aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c
blob: bd024065c1b614e760227dd2ee1f3258fc2f1f08 (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
/* Check that __builtin_dispatch gets converted and the executable runs fine. 
   Since featureTest () returns 1, foo should be called and return 0.  Cloning
   and Hoisting is not even turned on here. */
/* { dg-do run } */

int __attribute__ ((version_selector))
featureTest ()
{
  return 1;
}

int __attribute__ ((cold))
foo ()
{
  return 0;
}

int __attribute__ ((cold))
bar ()
{
  return 1;
}

int __attribute__ ((cold))
main ()
{
  int a, b;
  a = __builtin_dispatch (featureTest, (void *)foo, (void *) bar);
  b = __builtin_dispatch (featureTest, (void *)bar, (void *) foo);
  return a * b;
}