]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/50017 (-fcompare-debug failure)
authorJakub Jelinek <jakub@redhat.com>
Thu, 18 Aug 2011 14:13:48 +0000 (16:13 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 18 Aug 2011 14:13:48 +0000 (16:13 +0200)
PR debug/50017
* tree-vect-stmts.c (vect_finish_stmt_generation): If gsi_stmt (*gsi)
is a debug stmt, use location of the first non-debug stmt after it.

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

From-SVN: r177857

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

index 314efcdfdb4bed0e36851e7eabd527276e9b1cfc..d7df6315d18e9f9828bfe5cd6571807828ad7433 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/50017
+       * tree-vect-stmts.c (vect_finish_stmt_generation): If gsi_stmt (*gsi)
+       is a debug stmt, use location of the first non-debug stmt after it.
+
 2011-08-18  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * config/arm/arm.c (arm_rtx_costs_1): Don't modify the costs of SET.
index d47caaf9e08e73f0de5a0880d4bec07d262e6bac..0b09a0cca248501773ce1b59e217bc34c4ede63e 100644 (file)
@@ -2,6 +2,9 @@
 
        * g++.dg/plugin/decl_plugin.c: Include diagnostic.h.
 
+       PR debug/50017
+       * gcc.dg/pr50017.c: New test.
+
 2011-08-18  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/45625
diff --git a/gcc/testsuite/gcc.dg/pr50017.c b/gcc/testsuite/gcc.dg/pr50017.c
new file mode 100644 (file)
index 0000000..66bef00
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR debug/50017 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+
+struct S { int r, i; };
+
+void
+foo (struct S *x, int y)
+{
+  int i;
+  for (i = 1; i < y; i++)
+    {
+      struct S a, b, c;
+      a = x[0];
+      b = x[i];
+      c.r = a.r * b.r - a.i * b.i;
+      c.i = a.r * b.i + a.i * b.r;
+      x[i] = c;
+    }
+}
index e00822b7ea49fe3b8bb6ed38160a0b0c35d10e30..c0ca2af8e8022a5e3ea4c8d1ce3f3b495dcae020 100644 (file)
@@ -1,5 +1,5 @@
 /* Statement Analysis and Transformation for Vectorization
-   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Dorit Naishlos <dorit@il.ibm.com>
    and Ira Rosen <irar@il.ibm.com>
@@ -1419,6 +1419,7 @@ 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);
 
@@ -1433,7 +1434,13 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
       print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM);
     }
 
-  gimple_set_location (vec_stmt, gimple_location (gsi_stmt (*gsi)));
+  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)));
 }
 
 /* Checks if CALL can be vectorized in type VECTYPE.  Returns