|
|
dc1507 |
2010-07-07 Jakub Jelinek <jakub@redhat.com>
|
|
|
dc1507 |
|
|
|
dc1507 |
* tree-sra.c (sra_build_assignment): Don't add BIT_XOR_EXPR/MINUS_EXPR
|
|
|
dc1507 |
of signbit if signbit is the most significant bit of utype already.
|
|
|
dc1507 |
|
|
|
dc1507 |
* gcc.c-torture/execute/20100707-1.c: New test.
|
|
|
dc1507 |
|
|
|
dc1507 |
--- gcc/tree-sra.c.jj 2010-05-13 13:08:52.000000000 +0200
|
|
|
dc1507 |
+++ gcc/tree-sra.c 2010-07-06 19:50:09.000000000 +0200
|
|
|
dc1507 |
@@ -2211,7 +2211,10 @@ sra_build_assignment (tree dst, tree src
|
|
|
dc1507 |
|
|
|
dc1507 |
/* Perform sign extension, if required.
|
|
|
dc1507 |
??? This should never be necessary. */
|
|
|
dc1507 |
- if (!unsignedp)
|
|
|
dc1507 |
+ if (!unsignedp
|
|
|
dc1507 |
+ && (TREE_INT_CST_LOW (width) != TYPE_PRECISION (utype)
|
|
|
dc1507 |
+ || (TREE_INT_CST_LOW (width)
|
|
|
dc1507 |
+ != GET_MODE_BITSIZE (TYPE_MODE (utype)))))
|
|
|
dc1507 |
{
|
|
|
dc1507 |
tree signbit = int_const_binop (LSHIFT_EXPR,
|
|
|
dc1507 |
build_int_cst_wide (utype, 1, 0),
|
|
|
dc1507 |
--- gcc/testsuite/gcc.c-torture/execute/20100707-1.c 2010-05-27 15:41:40.446237053 +0200
|
|
|
dc1507 |
+++ gcc/testsuite/gcc.c-torture/execute/20100707-1.c 2010-07-06 13:55:35.000000000 +0200
|
|
|
dc1507 |
@@ -0,0 +1,50 @@
|
|
|
dc1507 |
+struct S { int s; };
|
|
|
dc1507 |
+struct T { int w; int h; };
|
|
|
dc1507 |
+int vr;
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+inline struct T
|
|
|
dc1507 |
+bar (const struct S * x)
|
|
|
dc1507 |
+{
|
|
|
dc1507 |
+ struct T t;
|
|
|
dc1507 |
+ t.w = vr;
|
|
|
dc1507 |
+ t.h = x->s;
|
|
|
dc1507 |
+ return t;
|
|
|
dc1507 |
+}
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+__attribute__ ((noinline))
|
|
|
dc1507 |
+void foo (struct S * w, unsigned char *x, int y, int *z[2])
|
|
|
dc1507 |
+{
|
|
|
dc1507 |
+ struct T t;
|
|
|
dc1507 |
+ int i, j, k;
|
|
|
dc1507 |
+ t = bar (w);
|
|
|
dc1507 |
+ k = t.w + 2;
|
|
|
dc1507 |
+ for (i = 0; i <= t.h; i++)
|
|
|
dc1507 |
+ {
|
|
|
dc1507 |
+ int *u = z[i > 0] + 1;
|
|
|
dc1507 |
+ unsigned char *v;
|
|
|
dc1507 |
+ int q = 0;
|
|
|
dc1507 |
+ v = x + k * i + 1;
|
|
|
dc1507 |
+ for (j = 0; j < t.w; j++)
|
|
|
dc1507 |
+ {
|
|
|
dc1507 |
+ int m = u[j];
|
|
|
dc1507 |
+ if (m > y && !q && v[j - k] != 2)
|
|
|
dc1507 |
+ v[j] = 0;
|
|
|
dc1507 |
+ }
|
|
|
dc1507 |
+ }
|
|
|
dc1507 |
+}
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+unsigned char b[64];
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+int
|
|
|
dc1507 |
+main (void)
|
|
|
dc1507 |
+{
|
|
|
dc1507 |
+ int v[32], *z[2];
|
|
|
dc1507 |
+ struct S s;
|
|
|
dc1507 |
+ __builtin_memset (v, 0, sizeof (v));
|
|
|
dc1507 |
+ vr = 16;
|
|
|
dc1507 |
+ s.s = 16;
|
|
|
dc1507 |
+ z[0] = v;
|
|
|
dc1507 |
+ z[1] = v;
|
|
|
dc1507 |
+ foo (&s, b + 32, -1, z);
|
|
|
dc1507 |
+ return 0;
|
|
|
dc1507 |
+}
|