OSDN Git Service

2013-01-24 Martin Jambor <mjambor@suse.cz>
[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 #include <stdlib.h>
11
12 int globvar;
13
14 void
15 leave (int i)
16 {
17   if (i != 0)
18     abort ();
19   exit (0);
20 }
21
22 void
23 doit ()
24 {
25   srand (12);
26   globvar = rand ();
27   if (rand () > 0)
28     globvar = 0;
29   leave (globvar);
30 }
31
32 int
33 main ()
34 {
35   doit ();
36 }
37
38 /* { dg-final { cleanup-coverage-files } } */