aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c
blob: b55de13af93395fa49e58bfdacd3e71a67f641e3 (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
/* { dg-do run } */
/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */

/* Test for deliberate misprediction of indirect calls for ELFv2.  */

int (*f)();

int __attribute__((noinline)) bar ()
{
  return (*f) ();
}

int g ()
{
  return 26;
}

int main ()
{
  f = &g;
  if (bar () != 26)
    __builtin_abort ();

  return 0;
}