Debian Codegraph @

gcc/testsuite/gcc.dg/tree-prof/split-1.c

raw
1 /* Test that we don't get a link-time error when using -fsplit-stack
2 due to implicit enabling of -freorder-blocks-and-partition. */
3 /* { dg-require-effective-target split_stack } */
4 /* { dg-options "-O2 -fsplit-stack" } */
5
6 extern unsigned int sleep (unsigned int);
7
8 #define SIZE 10000
9
10 const char *sarr[SIZE];
11 const char *buf_hot;
12 const char *buf_cold;
13
14 __attribute__((noinline))
15 void
16 foo (int path)
17 {
18 int i;
19 if (path)
20 {
21 for (i = 0; i < SIZE; i++)
22 sarr[i] = buf_hot;
23 }
24 else
25 {
26 for (i = 0; i < SIZE; i++)
27 sarr[i] = buf_cold;
28 sleep (0);
29 }
30 }
31
32 int
33 main (int argc, char *argv[])
34 {
35 int i;
36 buf_hot = "hello";
37 buf_cold = "world";
38 for (i = 0; i < 1000000; i++)
39 foo (argc);
40 return 0;
41 }