re PR debug/63328 (c-c++-common/gomp/pr60823-3.c test fails with -fcompare-debug)
authorJakub Jelinek <jakub@redhat.com>
Mon, 22 Sep 2014 10:32:09 +0000 (12:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 22 Sep 2014 10:32:09 +0000 (12:32 +0200)
PR debug/63328
* omp-low.c (ipa_simd_modify_stmt_ops): For debug stmts
insert a debug source bind stmt setting DEBUG_EXPR_DECL
instead of a normal gimple assignment stmt.

* c-c++-common/gomp/pr63328.c: New test.

From-SVN: r215454

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/pr63328.c [new file with mode: 0644]

index 1a59543dcbaa7bea03a5ed77236b43f45bb3fa87..02101ee116ada464abaf61de6472b5da3473c9f5 100644 (file)
@@ -1,3 +1,10 @@
+2014-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/63328
+       * omp-low.c (ipa_simd_modify_stmt_ops): For debug stmts
+       insert a debug source bind stmt setting DEBUG_EXPR_DECL
+       instead of a normal gimple assignment stmt.
+
 2014-09-22  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * config/bfin/bfin.md: Fix use of constraints in define_split.
index be882f72628f09cfb36e36e82c90189e70a02860..82651eae7bb99a1ae2090750fbb7b9c4ad287db6 100644 (file)
@@ -11717,9 +11717,22 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data)
   if (tp != orig_tp)
     {
       repl = build_fold_addr_expr (repl);
-      gimple stmt
-       = gimple_build_assign (make_ssa_name (TREE_TYPE (repl), NULL), repl);
-      repl = gimple_assign_lhs (stmt);
+      gimple stmt;
+      if (is_gimple_debug (info->stmt))
+       {
+         tree vexpr = make_node (DEBUG_EXPR_DECL);
+         stmt = gimple_build_debug_source_bind (vexpr, repl, NULL);
+         DECL_ARTIFICIAL (vexpr) = 1;
+         TREE_TYPE (vexpr) = TREE_TYPE (repl);
+         DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (repl));
+         repl = vexpr;
+       }
+      else
+       {
+         stmt = gimple_build_assign (make_ssa_name (TREE_TYPE (repl),
+                                                    NULL), repl);
+         repl = gimple_assign_lhs (stmt);
+       }
       gimple_stmt_iterator gsi = gsi_for_stmt (info->stmt);
       gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
       *orig_tp = repl;
index c200560689de4f03eace411d8ce64b16d10396d3..9e7330b4a98f4b8016f97075a61f98746fd1016b 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/63328
+       * c-c++-common/gomp/pr63328.c: New test.
+
 2014-09-22  Martin Liska  <mliska@suse.cz>
 
        PR lto/63270
diff --git a/gcc/testsuite/c-c++-common/gomp/pr63328.c b/gcc/testsuite/c-c++-common/gomp/pr63328.c
new file mode 100644 (file)
index 0000000..3958abe
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR debug/63328 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp-simd -fno-strict-aliasing -fcompare-debug" } */
+
+#include "pr60823-3.c"