OSDN Git Service

PR testsuite/24841
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / nest.c
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 /* { dg-error "-pg not supported" "Profiler support missing" { target *-*-sco3.2v5* } 0 } */
8 /* { dg-bogus "\[Uu\]nresolved symbol ._mcount" "Profiling unsupported" { xfail *-*-netware* } 0 } */
9
10 extern void abort (void);
11
12 long foo (long x)
13 {
14   long i, sum = 0;
15   long bar (long z) { return z * 2; }
16
17   for (i = 0; i < x; i++)
18     sum += bar (i);
19
20   return sum;
21 }
22
23 int main (void)
24 {
25   if (foo(10) != 90)
26     abort ();
27   return 0;
28 }