re PR debug/80436 (-fcompare-debug failure)
authorJakub Jelinek <jakub@redhat.com>
Wed, 19 Apr 2017 16:29:45 +0000 (18:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 19 Apr 2017 16:29:45 +0000 (18:29 +0200)
PR debug/80436
* tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses.

* g++.dg/opt/pr80436.C: New test.

From-SVN: r247000

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr80436.C [new file with mode: 0644]
gcc/tree-ssa-loop-manip.c

index 1995cd536b0a643165f5a68bad8552957263c3dd..32af94d1b75c2356135e6103464288d4584ae021 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/80436
+       * tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses.
+
 2017-04-19  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/80462
index a6c392e64839b4e8a55c6115a9903d16a60b0d77..113506b6264a009876a9b24359ef2e98e2ea2413 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/80436
+       * g++.dg/opt/pr80436.C: New test.
+
 2017-04-19  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        * gcc.dg/torture/pr80341.c: Require int32plus.
diff --git a/gcc/testsuite/g++.dg/opt/pr80436.C b/gcc/testsuite/g++.dg/opt/pr80436.C
new file mode 100644 (file)
index 0000000..b5879bf
--- /dev/null
@@ -0,0 +1,42 @@
+// PR debug/80436
+// { dg-do compile { target c++11 } }
+// { dg-options "-O3 -fcompare-debug" }
+
+void fn (...);
+void foo (int, int, int);
+struct { int elt1; int bits; } *a;
+int b, d;
+
+int
+bar (unsigned *x)
+{
+  if (0)
+  next_bit:
+    return 1;
+  while (1)
+    {
+      if (b)
+       if (a->bits)
+         goto next_bit;
+      *x = b;
+      if (a->elt1)
+       return 0;
+      a = 0;
+    }
+}
+
+enum { C0, C1 } *c;
+
+void
+baz ()
+{
+  int e, m = d;
+  for (; e < m; e++)
+    {
+      if (e < 0)
+       foo (0, 0, c[e]);
+      unsigned f;
+      for (; bar (&f);)
+       fn (f);
+    }
+}
index 22c832ae1e1bb3a681bfaffbfcaecd30aadba994..70d1f8444a42b0a4664575322b305cf254c462be 100644 (file)
@@ -494,6 +494,9 @@ find_uses_to_rename_def (tree def, bitmap *use_blocks, bitmap need_phis)
 
   FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
     {
+      if (is_gimple_debug (use_stmt))
+       continue;
+
       basic_block use_bb = gimple_bb (use_stmt);
 
       use_operand_p use_p;