re PR tree-optimization/36504 (ICE when building xorg-server with -O3 -fprefetch...
authorJakub Jelinek <jakub@redhat.com>
Tue, 24 Jun 2008 10:06:17 +0000 (12:06 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 24 Jun 2008 10:06:17 +0000 (12:06 +0200)
PR tree-optimization/36504
* tree-ssa-loop-prefetch.c (gather_memory_references_ref): Skip
references without base address.

* gcc.dg/pr36504.c: New test.

From-SVN: r137061

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr36504.c [new file with mode: 0644]
gcc/tree-ssa-loop-prefetch.c

index 9ab80e03a9fac4794966e72389716ad215bb61bd..4a88491c3f8f6942d68e1b194d8e7b1051a042b7 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/36504
+       * tree-ssa-loop-prefetch.c (gather_memory_references_ref): Skip
+       references without base address.
+
 2008-06-23  Uros Bizjak  <ubizjak@gmail.com>
 
        PR middle-end/PR36584
index a377829b6744e7b342eb323992713a69bce74de0..c7a7cd26fb42d5fa2bcc5fdf98278b2d05eb6c0c 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/36504
+       * gcc.dg/pr36504.c: New test.
+
 2008-06-23  Uros Bizjak  <ubizjak@gmail.com>
 
        PR middle-end/PR36584
diff --git a/gcc/testsuite/gcc.dg/pr36504.c b/gcc/testsuite/gcc.dg/pr36504.c
new file mode 100644 (file)
index 0000000..0db6ebc
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR tree-optimization/36504 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fprefetch-loop-arrays" } */
+
+struct A { struct { int a; } b[8]; };
+struct B { int c; int d; };
+struct C { struct B d; };
+
+void bar (struct C *, int);
+
+struct B
+foo (struct C *p, struct A *e, int b)
+{
+  struct B q;
+  bar (p, e->b[b].a);
+  return q;
+}
+
+void
+baz (int b, struct A *e)
+{
+  struct C p;
+  for (; b; ++b)
+    p.d = foo (&p, e, b);
+}
index 651ccbb5227bad292f2ffbb5e7ada2654f64cbe9..14044c407d75570ea7333d9fd6bbf222a45a4a13 100644 (file)
@@ -457,6 +457,9 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
   HOST_WIDE_INT step, delta;
   struct mem_ref_group *agrp;
 
+  if (get_base_address (ref) == NULL)
+    return false;
+
   if (!analyze_ref (loop, &ref, &base, &step, &delta, stmt))
     return false;