| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -finstrument-functions" } */ |
| 3 |
/* { dg-require-effective-target return_address } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
extern void exit (int); |
| 7 |
|
| 8 |
double |
| 9 |
foo (double a, double b) |
| 10 |
{ |
| 11 |
double c; |
| 12 |
if (0.0 < a) |
| 13 |
c = a; |
| 14 |
else if (b > 0.0) |
| 15 |
c = 0.0; |
| 16 |
else |
| 17 |
return 0; |
| 18 |
return 2.0 * (b - c); |
| 19 |
} |
| 20 |
|
| 21 |
int main () |
| 22 |
{ |
| 23 |
if (foo (1.0, 4.0) != 6.0) |
| 24 |
abort (); |
| 25 |
exit (0); |
| 26 |
} |
| 27 |
|
| 28 |
/* Abort on non-NULL CALL_SITE to ensure that __builtin_return_address |
| 29 |
was expanded properly. */ |
| 30 |
void __attribute__((no_instrument_function)) |
| 31 |
__cyg_profile_func_enter(void *this_fn, void *call_site) |
| 32 |
{ |
| 33 |
if (call_site == (void *)0) |
| 34 |
abort (); |
| 35 |
} |
| 36 |
|
| 37 |
void __attribute__((no_instrument_function)) |
| 38 |
__cyg_profile_func_exit(void *this_fn, void *call_site) |
| 39 |
{ |
| 40 |
if (call_site == (void *)0) |
| 41 |
abort (); |
| 42 |
} |
| 43 |
|