re PR tree-optimization/33833 (ICE in build2_stat, at tree.c:3110 at -O3, tree-vector...
authorIra Rosen <irar@gcc.gnu.org>
Thu, 25 Oct 2007 16:41:45 +0000 (16:41 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 25 Oct 2007 16:41:45 +0000 (16:41 +0000)
PR tree-optimization/33833
* tree-vect-analyze.c (vect_analyze_data_refs): Use POINTER_PLUS_EXPR
and convert init to sizetype in inner_base construction.

From-SVN: r129628

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr33833.c [new file with mode: 0644]
gcc/tree-vect-analyze.c

index 7c4c706f2d5fa6342eb8617915a379b2e2aef96b..2a3ca69e9fca3ce3d3297a83e4ecd509760521df 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-25  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/33833
+       * tree-vect-analyze.c (vect_analyze_data_refs): Use POINTER_PLUS_EXPR
+       and convert init to sizetype in inner_base construction.
+
 2007-10-25  Richard Guenther  <rguenther@suse.de>
 
        * tree-flow.h (mem_sym_stats): Remove.
index 781a541890e0cc00b0e28969c00c38e4c633b113..5551ed5f80aeada73248a94a2858aea42f6e9697 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-25  Martin Michlmayr <tbm@cyrius.com>
+            Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/33833
+       * gcc.dg/vect/pr33833.c: New testcase.
+
 2007-10-25  David Daney  <ddaney@avtrex.com>
 
        * gcc.dg/tree-ssa/20040204-1.c: Un-xfail for mips*-*-*.
diff --git a/gcc/testsuite/gcc.dg/vect/pr33833.c b/gcc/testsuite/gcc.dg/vect/pr33833.c
new file mode 100644 (file)
index 0000000..f862a91
--- /dev/null
@@ -0,0 +1,31 @@
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+/* { dg-do compile } */
+
+struct list_head
+{
+  struct list_head *prev;
+};
+struct prio_array
+{
+  struct list_head queue[100];
+};
+struct rq
+{
+  struct prio_array *active, arrays[2];
+} per_cpu__runqueues;
+
+void sched_init (unsigned long __ptr)
+{
+  int j, k;
+  struct prio_array *array;
+  struct rq *rq;
+  rq = (&(*( { (typeof (&per_cpu__runqueues)) (__ptr); } )));
+  for (j = 0; j < 2; j++)
+  {
+    array = rq->arrays + j;
+    for (k = 0; k < 100; k++)
+        (array->queue + k)->prev = array->queue;
+  }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 8975e64ab719eb9ab6a6b9c6063405827e306e31..2bb28da32b0e7987ce98ed69c4c1cc7f3390e875 100644 (file)
@@ -3287,10 +3287,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
 
          /* Build a reference to the first location accessed by the 
             inner-loop: *(BASE+INIT). (The first location is actually
-            BASE+INIT+OFFSET, but we add OFFSET separately later.  */
-         tree inner_base = build_fold_indirect_ref 
-                               (fold_build2 (PLUS_EXPR, 
-                                             TREE_TYPE (base), base, init));
+            BASE+INIT+OFFSET, but we add OFFSET separately later).  */
+          tree inner_base = build_fold_indirect_ref
+                                (fold_build2 (POINTER_PLUS_EXPR,
+                                              TREE_TYPE (base), base, 
+                                              fold_convert (sizetype, init)));
 
          if (vect_print_dump_info (REPORT_DETAILS))
            {