re PR tree-optimization/36967 (segfault in is_gimple_real_type with -fpredictive...
authorRichard Guenther <rguenther@suse.de>
Wed, 30 Jul 2008 15:43:42 +0000 (15:43 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 30 Jul 2008 15:43:42 +0000 (15:43 +0000)
2008-07-30  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/36967
* tree-predcom.c (remove_stmt): Use gimple_assign_ssa_name_copy_p.
Release defs of statements we remove.

* gfortran.dg/pr36967.f: New testcase.

From-SVN: r138318

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr36967.f [new file with mode: 0644]
gcc/tree-predcom.c

index 4e6acf0e6271e26ff6f6be43b89ef74b3f540a77..474cc2cc90cd96672e02e9eb0c33b0b7473aa814 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36967
+       * tree-predcom.c (remove_stmt): Use gimple_assign_ssa_name_copy_p.
+       Release defs of statements we remove.
+
 2008-07-30  Nathan Froyd  <froydnj@codesourcery.com>
 
         * config/arm/arm.c (arm_expand_prologue): Use 0-length rtvec
index c53755b4db02f1b78520f65cc4467180a1cc00ad..cdfa2945dcf9c357ade0ae185db6182874c62be0 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36967
+       * gfortran.dg/pr36967.f: New testcase.
+
 2008-07-30  Rafael Avila de Espindola  <espindola@google.com>
 
        * gcc.dg/visibility-14.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr36967.f b/gcc/testsuite/gfortran.dg/pr36967.f
new file mode 100644 (file)
index 0000000..4f85897
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-options "-O2 -fpredictive-commoning" }
+      subroutine foo(x,y,n)
+      integer n
+      real*8 y(n,n,n),x(n,n,n)
+      integer k, j, i
+      do k = 2, n-1
+        do j = 2, n-1
+          do I = 2, n-1
+            y(i,j,k) = y(i,j,k)
+     +        + (x(i-1,j-1,k)
+     +           +  x(i,j-1,k-1)
+     +           +  x(i,j+1,k-1)
+     +           +  x(i,j+1,k+1)
+     +           +  x(i+1,j,k+1))
+     +        + (x(i-1,j-1,k-1)
+     +           +  x(i+1,j-1,k-1)
+     +           +  x(i-1,j+1,k-1)
+     +           +  x(i+1,j+1,k-1)
+     +           +  x(i-1,j+1,k+1)
+     +           +  x(i+1,j+1,k+1))
+          enddo
+        enddo
+      enddo
+      return
+      end
index 63911b3dbe51871cb7db49ac8ed9df9648fcb1a1..94245a4678bf61cc6dd175f249b56d7c19af13f1 100644 (file)
@@ -1707,7 +1707,7 @@ remove_stmt (gimple stmt)
       remove_phi_node (&psi, true);
 
       if (!next
-         || !gimple_assign_copy_p (next)
+         || !gimple_assign_ssa_name_copy_p (next)
          || gimple_assign_rhs1 (next) != name)
        return;
 
@@ -1727,9 +1727,10 @@ remove_stmt (gimple stmt)
 
       mark_virtual_ops_for_renaming (stmt);
       gsi_remove (&bsi, true);
+      release_defs (stmt);
 
       if (!next
-         || !gimple_assign_copy_p (next)
+         || !gimple_assign_ssa_name_copy_p (next)
          || gimple_assign_rhs1 (next) != name)
        return;