| 1 |
/* PR 5967, PR 7114 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-profiling "-pg" } */ |
| 4 |
/* { dg-options "-O2 -pg" } */ |
| 5 |
/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */ |
| 6 |
/* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */ |
| 7 |
|
| 8 |
extern void abort (void); |
| 9 |
|
| 10 |
long foo (long x) |
| 11 |
{ |
| 12 |
long i, sum = 0; |
| 13 |
long bar (long z) { return z * 2; } |
| 14 |
|
| 15 |
for (i = 0; i < x; i++) |
| 16 |
sum += bar (i); |
| 17 |
|
| 18 |
return sum; |
| 19 |
} |
| 20 |
|
| 21 |
int main (void) |
| 22 |
{ |
| 23 |
if (foo(10) != 90) |
| 24 |
abort (); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
/* { dg-final { cleanup-profile-file } } */ |