OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20020201-1.c
1 /* Check that arc profiling instrumentation code does not cause problems for
2    a program that calls functions that are likely to be in a shared library.
3    This was added to check the fix for PR target/5469, which prevents arc
4    profiling code from being inserted between a call and the restore of the
5    call-clobbered global pointer.  */
6
7 /* { dg-options "-fprofile-arcs" } */
8 /* { dg-do run { target native } } */
9
10 extern void abort (void);
11 extern void exit (int);
12
13 int rand (void);
14 void srand (unsigned int seed);
15
16 int globvar;
17
18 void
19 leave (int i)
20 {
21   if (i != 0)
22     abort ();
23   exit (0);
24 }
25
26 void
27 doit ()
28 {
29   srand (12);
30   globvar = rand ();
31   if (rand () > 0)
32     globvar = 0;
33   leave (globvar);
34 }
35
36 int
37 main ()
38 {
39   doit ();
40 }
41
42 /* { dg-final { cleanup-coverage-files } } */