From b7926cf90567f9c9e12cdcc8935c58223055fe90 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 8 Aug 2011 16:33:06 +0000 Subject: [PATCH] Add a testcase for PR target/49781. 2011-08-08 H.J. Lu PR target/49781 * gcc.target/i386/pr49781-1.c: New. From-SVN: r177569 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr49781-1.c | 26 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr49781-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b4c15a62a8..4ce23b79764 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-08-08 H.J. Lu + + PR target/49781 + * gcc.target/i386/pr49781-1.c: New. + 2011-08-08 Jason Merrill * g++.dg/cpp0x/range-for20.C: Adjust to test 50020 as well. diff --git a/gcc/testsuite/gcc.target/i386/pr49781-1.c b/gcc/testsuite/gcc.target/i386/pr49781-1.c new file mode 100644 index 00000000000..80db03416e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr49781-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-require-effective-target fpic } */ + +static int heap[2*(256 +1+29)+1]; +static int heap_len; +static int heap_max; +void +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); +} + +/* { dg-final { scan-assembler-not "lea\[lq\]?\[ \t\]\\((%|)r\[a-z0-9\]*" } } */ -- 2.30.2