re PR debug/42299 (another verify_ssa failure with -g -O2)
authorRichard Henderson <rth@redhat.com>
Mon, 7 Dec 2009 22:42:10 +0000 (14:42 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 7 Dec 2009 22:42:10 +0000 (14:42 -0800)
PR debug/42299
PR debug/42166
* tree-ssa.c (insert_debug_temp_for_var_def): Skip propagation
for ssa names already registered for update.

From-SVN: r155063

gcc/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr42299.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr42166.f90 [new file with mode: 0644]
gcc/tree-ssa.c

index 4056a35..a10b288 100644 (file)
@@ -1,3 +1,10 @@
+2009-12-07  Richard Henderson  <rth@redhat.com>
+
+       PR debug/42299
+       PR debug/42166
+       * tree-ssa.c (insert_debug_temp_for_var_def): Skip propagation
+       for ssa names already registered for update.
+
 2009-12-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/42244
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42299.c b/gcc/testsuite/gcc.c-torture/compile/pr42299.c
new file mode 100644 (file)
index 0000000..5a9199f
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-options "-g" } */
+
+static int
+foo (int x, int y)
+{
+  if (y)
+    goto lab;
+  if (x)
+    y = 0;
+  if (y)
+    goto lab;
+  y = 0;
+lab:
+  return y;
+}
+
+void
+baz (int x, int y)
+{
+  y = foo (x, y);
+  if (y != 0)
+    bar ();
+}
diff --git a/gcc/testsuite/gfortran.dg/pr42166.f90 b/gcc/testsuite/gfortran.dg/pr42166.f90
new file mode 100644 (file)
index 0000000..5b97815
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-options "-O2 -g" }
+
+MODULE powell
+  INTEGER, PARAMETER :: dp=8
+CONTAINS
+  SUBROUTINE newuob (n,  bmat,  ndim,  d,  vlag,  w, npt)
+    REAL(dp), DIMENSION(ndim, *), INTENT(inout) :: bmat
+    REAL(dp), DIMENSION(*), INTENT(inout)    :: d, vlag, w
+    REAL(dp) :: sum
+    INTEGER, INTENT(in) :: npt
+    DO j=1,n
+       jp=npt+j
+       DO k=1,n
+          sum=sum+bmat(jp,k)*d(k)
+       END DO
+       vlag(jp)=sum
+    END DO
+  END SUBROUTINE newuob
+END MODULE powell
+
index b5d60b3..9947e57 100644 (file)
@@ -312,9 +312,13 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
   if (!MAY_HAVE_DEBUG_STMTS)
     return;
 
-  /* First of all, check whether there are debug stmts that reference
-     this variable and, if there are, decide whether we should use a
-     debug temp.  */
+  /* If this name has already been registered for replacement, do nothing
+     as anything that uses this name isn't in SSA form.  */
+  if (name_registered_for_update_p (var))
+    return;
+
+  /* Check whether there are debug stmts that reference this variable and,
+     if there are, decide whether we should use a debug temp.  */
   FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var)
     {
       stmt = USE_STMT (use_p);