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
leave(int i)15 leave (int i)
16 {
17 if (i != 0)
18 abort ();
19 exit (0);
20 }
21
22 void
doit()23 doit ()
24 {
25 srand (12);
26 globvar = rand ();
27 if (rand () > 0)
28 globvar = 0;
29 leave (globvar);
30 }
31
32 int
main()33 main ()
34 {
35 doit ();
36 }
37
38 /* { dg-final { cleanup-coverage-files } } */
39