OSDN Git Service

* lib/gcc-dg.exp (dg-require-profiling): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20021014-1.c
1 /* { dg-do run } */
2 /* { dg-require-profiling "" } */
3 /* { dg-options "-O2 -p" } */
4 /* { dg-options "-O2 -p -static" { target hppa*-*-hpux* } } */
5 /* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */
6 /* { dg-error "" "consider using `-pg' instead of `-p' with gprof(1)" { target *-*-freebsd* } 0 } */
7 /* Support for -p on solaris2 relies on mcrt1.o which comes with the
8    vendor compiler.  We cannot reiably predict the directory where the
9    vendor compiler (and thus mcrt1.o) is installed so we can't
10    necessarily find mcrt1.o even if we have it.  */
11 /* { dg-error "mcrt1.o" "Optional vendor profiler support missing" { target *-*-solaris2* } 0 } */
12 /* Support for -p on irix relies on libprof1.a which doesn't appear to
13    exist on any irix6 system currently posting testsuite results.  */
14 /* { dg-error "libprof1.a" "Profiler support missing" { target mips*-*-irix* } 0 } */
15
16 extern void abort (void);
17 extern void exit (int);
18
19 int foo (void)
20 {
21   static int bar (int x)
22   {
23     return x + 3;
24   }
25   return bar (1) + bar (2);
26 }
27
28 int main (void)
29 {
30   if (foo () != 9)
31     abort ();
32   exit (0);
33 }