]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/32399 (ICE in build2_stat, at tree.c:3074)
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Sat, 4 Aug 2007 00:33:31 +0000 (00:33 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sat, 4 Aug 2007 00:33:31 +0000 (17:33 -0700)
2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/32399
        * tree-ssa-address.c (add_to_parts): Use POINTER_PLUS_EXPR
        when adding to the base and convert ELT to sizetype instead of type.

2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        RP middle-end/32399
        * gcc.c-torture/compile/pr32399.c: New testcase.

From-SVN: r127196

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr32399.c [new file with mode: 0644]
gcc/tree-ssa-address.c

index eeb4a51e0ddbbc8ce6ebd6640d731628fdcd3051..b2bff86280959d9a6212064ff23f0a8534a9b07e 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR middle-end/32399
+       * tree-ssa-address.c (add_to_parts): Use POINTER_PLUS_EXPR
+       when adding to the base and convert ELT to sizetype instead of type.
+
 2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/32304
index ce38fc75bf83808825a7f623772972fc002f6045..8814bd2cbaa24c0579c5f809513fa9a615d0f976 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       RP middle-end/32399
+       * gcc.c-torture/compile/pr32399.c: New testcase.
+
 2007-08-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/32304
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32399.c b/gcc/testsuite/gcc.c-torture/compile/pr32399.c
new file mode 100644 (file)
index 0000000..cc2b1b1
--- /dev/null
@@ -0,0 +1,16 @@
+void f(unsigned char *src, unsigned char *dst, int num, unsigned char *pos, unsigned char *diffuse, int hasdiffuse, unsigned char *specular, int hasspecular) {
+    int i;
+
+    for(i=num;i--;) {
+       float *p = (float *) ((__SIZE_TYPE__) dst + (__SIZE_TYPE__) pos);
+        if(hasdiffuse) {
+            unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) diffuse);
+            *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) diffuse) + i);
+        }
+        if(hasspecular) {
+            unsigned int *dstColor = (unsigned int *) (dst + i + (__SIZE_TYPE__) specular);
+            *dstColor = * (unsigned int *) ( ((__SIZE_TYPE__) src + (__SIZE_TYPE__) specular) + i);
+        }
+    }
+}
+
index 577ede32bcc9fea67a8853b635eca377db6cb21b..90a01dca034b33fc4691097cf2b76f50c1852f72 100644 (file)
@@ -422,9 +422,9 @@ add_to_parts (struct mem_address *parts, tree elt)
 
   /* Add ELT to base.  */
   type = TREE_TYPE (parts->base);
-  parts->base = fold_build2 (PLUS_EXPR, type,
+  parts->base = fold_build2 (POINTER_PLUS_EXPR, type,
                             parts->base,
-                            fold_convert (type, elt));
+                            fold_convert (sizetype, elt));
 }
 
 /* Finds the most expensive multiplication in ADDR that can be