re PR tree-optimization/32230 (Segfault in set_bb_for_stmt with -O -ftree-vectorize)
authorIra Rosen <irar@il.ibm.com>
Mon, 2 Jul 2007 10:27:27 +0000 (10:27 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Mon, 2 Jul 2007 10:27:27 +0000 (10:27 +0000)
PR tree-optimization/32230
PR tree-optimization/32477
* tree-vect-analyze.c (vect_analyze_data_refs): Fail if base
address is a constant.

From-SVN: r126196

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

index f1452ac2a195c88de7ab2061a65e728f4708490d..a2691656661797da63253bb3d1037145f4cf0cdd 100644 (file)
@@ -1,3 +1,10 @@
+2007-07-02  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/32230
+       PR tree-optimization/32477
+       * tree-vect-analyze.c (vect_analyze_data_refs): Fail if base 
+       address is a constant.
+
 2007-07-02  Richard Sandiford  <richard@codesourcery.com>
 
        * config.gcc (mipsisa32-*-elf*, mipsisa32el-*-elf*)
index c08ccd90d3d766eb2b00e6209059b58c770f1825..ae9175355c90dd2c87677ffb32635ae04b8dead3 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-02  Ira Rosen  <irar@il.ibm.com>
+       PR tree-optimization/32230
+       * gcc.dg/vect/pr32230.c: New test.
+
 2007-07-01  Christopher D. Rickett  <crickett@lanl.gov>
 
        * bind_c_array_params.f03: New files for Fortran 2003 ISO C Binding.
diff --git a/gcc/testsuite/gcc.dg/vect/pr32230.c b/gcc/testsuite/gcc.dg/vect/pr32230.c
new file mode 100644 (file)
index 0000000..ed1e7b1
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+typedef struct filter_buffer filter_buffer_t;
+struct filter_buffer
+{
+  char buf[1];
+};
+typedef struct sbuf_header sbuf_header_t;
+struct sbuf_header
+{
+  char buf[1];
+}
+const_f (filter_buffer_t *buf)
+{
+  float val;
+  int i;
+
+  for (i = 0; i < 10; i++)
+    ((float*) (&((sbuf_header_t *) ((buf) == (filter_buffer_t *)&(buf)->buf[0]))->buf[0]))[i] = val;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+
index b4cd79d5b6ddc85c56da68d190fa06b6c722df7c..6cfea2b1c9f4269498e8ec622db769658b483359 100644 (file)
@@ -2092,6 +2092,15 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
             }
           return false;
         }
+
+      if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
+        {
+          if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+            fprintf (vect_dump, "not vectorized: base addr of dr is a "
+                     "constant");
+          return false;
+        }
+
       if (!DR_SYMBOL_TAG (dr))
         {
           if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))