summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20030717-1.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.c-torture/execute/20030717-1.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.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.c-torture/execute/20030717-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030717-1.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030717-1.c b/gcc/testsuite/gcc.c-torture/execute/20030717-1.c
new file mode 100644
index 000000000..7e43e44be
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030717-1.c
@@ -0,0 +1,69 @@
+/* PR target/11087
+ This testcase was miscompiled on ppc64, because basic_induction_var called
+ convert_modes, yet did not expect it to emit any new instructions.
+ Those were emitted at the end of the function and destroyed during life
+ analysis, while the program used uninitialized pseudos created by
+ convert_modes. */
+
+struct A
+{
+ unsigned short a1;
+ unsigned long a2;
+};
+
+struct B
+{
+ int b1, b2, b3, b4, b5;
+};
+
+struct C
+{
+ struct B c1[1];
+ int c2, c3;
+};
+
+static
+int foo (int x)
+{
+ return x < 0 ? -x : x;
+}
+
+int bar (struct C *x, struct A *y)
+{
+ int a = x->c3;
+ const int b = y->a1 >> 9;
+ const unsigned long c = y->a2;
+ int d = a;
+ unsigned long e, f;
+
+ f = foo (c - x->c1[d].b4);
+ do
+ {
+ if (d <= 0)
+ d = x->c2;
+ d--;
+
+ e = foo (c-x->c1[d].b4);
+ if (e < f)
+ a = d;
+ }
+ while (d != x->c3);
+ x->c1[a].b4 = c + b;
+ return a;
+}
+
+int
+main ()
+{
+ struct A a;
+ struct C b;
+ int c;
+
+ a.a1 = 512;
+ a.a2 = 4242;
+ __builtin_memset (&b, 0, sizeof (b));
+ b.c1[0].b3 = 424242;
+ b.c2 = 1;
+ c = bar (&b, &a);
+ return 0;
+}