OSDN Git Service

981baece34e1bad3cad0ffb6fd0c3407f6a097bd
[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
9 extern void abort (void);
10
11 long foo (long x)
12 {
13   long i, sum = 0;
14   long bar (long z) { return z * 2; }
15
16   for (i = 0; i < x; i++)
17     sum += bar (i);
18
19   return sum;
20 }
21
22 int main (void)
23 {
24   if (foo(10) != 90)
25     abort ();
26   return 0;
27 }