1 /* { dg-do run } */
2 
3 static int heap[2*(256 +1+29)+1];
4 static int heap_len;
5 static int heap_max;
6 void
7 __attribute__ ((noinline))
foo(int elems)8 foo (int elems)
9 {
10   int n, m;
11   int max_code = -1;
12   int node = elems;
13   heap_len = 0, heap_max = (2*(256 +1+29)+1);
14   for (n = 0; n < elems; n++)
15     heap[++heap_len] = max_code = n;
16   do {
17     n = heap[1];
18     heap[1] = heap[heap_len--];
19     m = heap[1];
20     heap[--heap_max] = n;
21     heap[--heap_max] = m;
22   } while (heap_len >= 2);
23 }
24 
25 int
main()26 main ()
27 {
28   foo (286);
29   return 0;
30 }
31