OSDN Git Service

* tree-ssa-dom.c (propagate_rhs_into_lhs): Temporarily work
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Mar 2006 07:51:32 +0000 (07:51 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Mar 2006 07:51:32 +0000 (07:51 +0000)
around bug in immediate-use iterator.

* gcc.c-torture/compile/pr26833.c: New test.
* gfortran.fortran-torture/compile/pr26806.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112348 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr26833.c [new file with mode: 0644]
gcc/testsuite/gfortran.fortran-torture/compile/pr26806.f90 [new file with mode: 0644]
gcc/tree-ssa-dom.c

index a43f4f8..5215e63 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-24  Jeff Law  <law@redhat.com>
+
+       * tree-ssa-dom.c (propagate_rhs_into_lhs): Temporarily work
+       around bug in immediate-use iterator.
+
 2006-03-24  Alan Modra  <amodra@bigpond.net.au>
 
        PR target/26607
 2006-03-24  Alan Modra  <amodra@bigpond.net.au>
 
        PR target/26607
index 064a457..4d5e5db 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-24  Jeff Law  <law@redhat.com>
+
+       * gcc.c-torture/compile/pr26833.c: New test.
+       * gfortran.fortran-torture/compile/pr26806.f90: New test.
+
 2006-03-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gfortran.dg/endfile_2.f90: Delete temp file.
 2006-03-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gfortran.dg/endfile_2.f90: Delete temp file.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26833.c b/gcc/testsuite/gcc.c-torture/compile/pr26833.c
new file mode 100644 (file)
index 0000000..76c201c
--- /dev/null
@@ -0,0 +1,19 @@
+void yasm_lc3b__parse_insn( int num_info, int *num_operands
+ , int *operands, int op)
+{
+  int found = 0;
+  int i;
+  for (; num_info>0 && !found; num_info--)
+   {
+    int mismatch = 0;
+     for(i = 0;op && (i<*num_operands)&& !mismatch; i++)
+     {
+       if (!(int)(operands[i] & 0x1))
+         mismatch = 1;
+       if (mismatch)
+         break;
+     }
+    if (!mismatch)
+      found = 1;
+  }
+}
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr26806.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr26806.f90
new file mode 100644 (file)
index 0000000..fad5e9d
--- /dev/null
@@ -0,0 +1,11 @@
+module solv_cap
+  integer,       private, save :: Ng1=0, Ng2=0
+contains
+  subroutine FourirG(G)
+    real, intent(in out), dimension(0:,0:) :: G
+    complex, allocatable, dimension(:,:)   :: t
+    allocate( t(0:2*Ng1-1,0:2*Ng2-1) )
+    t(0:Ng1,0:Ng2-1)    = G(:,0:Ng2-1)      ! Fill one quadrant (one extra row)
+    t(0:Ng1,Ng2:2*Ng2-1) = G(:,Ng2:1:-1)    ! This quadrant using symmetry
+  end subroutine FourirG
+end module solv_cap
index daa2f0e..9df59e9 100644 (file)
@@ -2134,6 +2134,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
       /* Walk over every use of LHS and try to replace the use with RHS. 
         At this point the only reason why such a propagation would not
         be successful would be if the use occurs in an ASM_EXPR.  */
       /* Walk over every use of LHS and try to replace the use with RHS. 
         At this point the only reason why such a propagation would not
         be successful would be if the use occurs in an ASM_EXPR.  */
+    repeat:
       FOR_EACH_IMM_USE_SAFE (use_p, iter, lhs)
        {
          tree use_stmt = USE_STMT (use_p);
       FOR_EACH_IMM_USE_SAFE (use_p, iter, lhs)
        {
          tree use_stmt = USE_STMT (use_p);
@@ -2264,6 +2265,24 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
            }
        }
 
            }
        }
 
+      /* Due to a bug in the immediate use iterator code, we can
+        miss visiting uses in some cases when there is more than
+        one use in a statement.  Missing a use can cause a multitude
+         of problems if we expected to eliminate all uses and remove
+         the defining statement.
+
+        Until Andrew can fix the iterator, this hack will detect
+        the cases which cause us problems.  Namely if ALL is set
+        and we still have some immediate uses, then we must have
+        skipped one or more in the loop above.  So just re-execute
+        the loop.
+
+        The maximum number of times we can re-execute the loop is
+        bounded by the maximum number of times a given SSA_NAME
+        appears in a single statement.  */
+      if (all && num_imm_uses (lhs) != 0)
+       goto repeat;
+
       /* If we were able to propagate away all uses of LHS, then
         we can remove STMT.  */
       if (all)
       /* If we were able to propagate away all uses of LHS, then
         we can remove STMT.  */
       if (all)