| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fharden-control-flow-redundancy -fno-exceptions -fdump-tree-hardcfr -ffat-lto-objects" } */ |
| 3 |
/* { dg-require-effective-target untyped_assembly } */ |
| 4 |
|
| 5 |
extern int foobar (void); |
| 6 |
|
| 7 |
#if __cplusplus |
| 8 |
typedef void (*fnt)(...); |
| 9 |
#else |
| 10 |
typedef void (*fnt)(); |
| 11 |
#endif |
| 12 |
|
| 13 |
int i; |
| 14 |
|
| 15 |
int f(void) { |
| 16 |
if (i) |
| 17 |
__builtin_return (__builtin_apply ((fnt)foobar, |
| 18 |
__builtin_apply_args (), 0)); |
| 19 |
return i; |
| 20 |
} |
| 21 |
|
| 22 |
int g(void) { |
| 23 |
__builtin_return (__builtin_apply ((fnt)foobar, |
| 24 |
__builtin_apply_args (), 0)); |
| 25 |
} |
| 26 |
|
| 27 |
/* Out-of-line checking, before both builtin_return and return in f. */ |
| 28 |
/* { dg-final { scan-tree-dump-times "__hardcfr_check" 2 "hardcfr" } } */ |
| 29 |
/* Inline checking before builtin_return in g. */ |
| 30 |
/* { dg-final { scan-tree-dump-times "__builtin_trap" 1 "hardcfr" } } */ |