Add a testcase for PR middle-end/47383.
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2011 14:44:54 +0000 (14:44 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Aug 2011 14:44:54 +0000 (14:44 +0000)
2011-08-03  H.J. Lu  <hongjiu.lu@intel.com>

PR middle-end/47383
* gcc.dg/torture/pr47383.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177277 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr47383.c [new file with mode: 0644]

index 2dc9a1d..a157259 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR middle-end/47383
+       * gcc.dg/torture/pr47383.c: Likewise.
+
 2011-08-03  Arnaud Charlet  <charlet@adacore.com>
 
        * gnat.dg/specs/debug1.ads: Add missing -margs switch.
diff --git a/gcc/testsuite/gcc.dg/torture/pr47383.c b/gcc/testsuite/gcc.dg/torture/pr47383.c
new file mode 100644 (file)
index 0000000..ae8d670
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+
+static int heap[2*(256 +1+29)+1];
+static int heap_len;
+static int heap_max;
+void 
+__attribute__ ((noinline))
+foo (int elems)
+{
+  int n, m;
+  int max_code = -1;
+  int node = elems;
+  heap_len = 0, heap_max = (2*(256 +1+29)+1);
+  for (n = 0; n < elems; n++)
+    heap[++heap_len] = max_code = n;
+  do {
+    n = heap[1];
+    heap[1] = heap[heap_len--];
+    m = heap[1];
+    heap[--heap_max] = n;
+    heap[--heap_max] = m;
+  } while (heap_len >= 2);
+}
+
+int
+main ()
+{
+  foo (286);
+  return 0;
+}