summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr33848.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/torture/pr33848.c
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr33848.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr33848.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr33848.c b/gcc/testsuite/gcc.dg/torture/pr33848.c
new file mode 100644
index 000000000..c3b85e9e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr33848.c
@@ -0,0 +1,43 @@
+/* &&foo should be hoisted, but on most targets, excess register pressure
+ forces it to be rematerialized before "data != &&foo". On targets that
+ have a "branch if registers are equal" instruction, this leads to the
+ branch having two LABEL_REFs: one for the branch target and one for
+ &&foo. When reloading &&foo into a register, reload would wrongly
+ say that &&foo was the target of the branch, and the real target would
+ then be removed as dead. */
+/* { dg-do link } */
+#define NVARS 30
+#define MULTI(X) \
+ X( 0), X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), \
+ X(10), X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19), \
+ X(20), X(21), X(22), X(23), X(24), X(25), X(26), X(27), X(28), X(29)
+
+#define DECLARE(INDEX) i##INDEX = gv[INDEX]
+#define COPY(INDEX) gv[INDEX] = i##INDEX
+
+volatile int gv[NVARS];
+void *volatile data;
+
+int
+main (void)
+{
+ __label__ foo;
+
+ if (gv[0] == 1)
+ goto foo;
+ data = &&foo;
+ do
+ {
+ int MULTI (DECLARE);
+ MULTI (COPY);
+ MULTI (COPY);
+ MULTI (COPY);
+ if (data != &&foo)
+ gv[0] = 1;
+ else
+ gv[1] = 2;
+ }
+ while (gv[0] > 0);
+ foo:
+ return 0;
+}