re PR tree-optimization/50133 (ICE: SIGSEGV in vect_finish_stmt_generation (gimple...
authorJakub Jelinek <jakub@redhat.com>
Mon, 22 Aug 2011 15:01:42 +0000 (17:01 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 22 Aug 2011 15:01:42 +0000 (17:01 +0200)
PR tree-optimization/50133
* tree-vect-stmts.c (vect_finish_stmt_generation): Copy location
from stmt instead of some statement around gsi.

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

From-SVN: r177958

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

index 14ab85913506f805a1feae56f9a5c7a54ca0f67f..b0aaf468f54370b1d7faf17bd7d40e25863126c1 100644 (file)
@@ -1,5 +1,9 @@
 2011-08-22  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/50133
+       * tree-vect-stmts.c (vect_finish_stmt_generation): Copy location
+       from stmt instead of some statement around gsi.
+
        PR middle-end/50141
        * expr.c (get_bit_range): Only use DECL_THREAD_LOCAL_P if
        innerdecl is a VAR_DECL.
index 72feb20c49310c8371789e87c4d4d9f05a6c521a..67a5e89e1abcd5794d11647587761ce490bb02e8 100644 (file)
@@ -1,5 +1,8 @@
 2011-08-22  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/50133
+       * gcc.dg/pr50133.c: New test.
+
        PR middle-end/50141
        * c-c++-common/cxxbitfields-6.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr50133.c b/gcc/testsuite/gcc.dg/pr50133.c
new file mode 100644 (file)
index 0000000..2c0f490
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR tree-optimization/50133 */
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -fno-tree-loop-im" } */
+
+extern int A[], B[];
+
+void
+foo (int z)
+{
+  int j, i;
+  for (j = 0; j < 32; j++)
+    {
+      int a = A[0];
+      for (i = 0; i < 16; i++)
+       a = A[i] ? a : z;
+      B[j] = a;
+    }
+}
index c0ca2af8e8022a5e3ea4c8d1ce3f3b495dcae020..bab19b8845b498b6f5fe44e57c754f24dc068508 100644 (file)
@@ -1419,7 +1419,6 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
   loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
   bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
-  gimple_stmt_iterator si;
 
   gcc_assert (gimple_code (stmt) != GIMPLE_LABEL);
 
@@ -1434,13 +1433,7 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
       print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM);
     }
 
-  si = *gsi;
-  if (is_gimple_debug (gsi_stmt (si)))
-    {
-      gsi_next_nondebug (&si);
-      gcc_assert (!gsi_end_p (si));
-    }
-  gimple_set_location (vec_stmt, gimple_location (gsi_stmt (si)));
+  gimple_set_location (vec_stmt, gimple_location (stmt));
 }
 
 /* Checks if CALL can be vectorized in type VECTYPE.  Returns