| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target lp64 } */ |
| 3 |
/* { dg-require-effective-target aarch64_bti_hw } */ |
| 4 |
/* If configured with --enable-standard-branch-protection, don't use |
| 5 |
command line option. */ |
| 6 |
/* { dg-additional-options "-mbranch-protection=standard" { target { ! default_branch_protection } } } */ |
| 7 |
|
| 8 |
#include<stdio.h> |
| 9 |
|
| 10 |
typedef int FP (int); |
| 11 |
|
| 12 |
int |
| 13 |
f1 (FP fp, int n) |
| 14 |
{ |
| 15 |
return (fp) (n); |
| 16 |
} |
| 17 |
|
| 18 |
int |
| 19 |
f2 (int n, FP fp) |
| 20 |
{ |
| 21 |
return (fp) (n); |
| 22 |
} |
| 23 |
|
| 24 |
int __attribute__ ((noinline)) |
| 25 |
func (int x) |
| 26 |
{ |
| 27 |
return x+1; |
| 28 |
} |
| 29 |
|
| 30 |
int main () |
| 31 |
{ |
| 32 |
int s = 0; |
| 33 |
s += f1 (func, 10); |
| 34 |
s += f2 (s, func); |
| 35 |
printf ("S: %d\n", s); |
| 36 |
return !(s == 23); |
| 37 |
} |