see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx sharing.
authorRafael Avila de Espindola <espindola@google.com>
Thu, 22 May 2008 15:49:30 +0000 (15:49 +0000)
committerRafael Espindola <espindola@gcc.gnu.org>
Thu, 22 May 2008 15:49:30 +0000 (15:49 +0000)
* see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx
sharing.

* gcc.c-torture/compile/20080522-1.c: New testcase.

From-SVN: r135770

gcc/ChangeLog
gcc/see.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20080522-1.c [new file with mode: 0644]

index 50754f75dbe398552588030a18bbb09fb7d6fd6d..8e6029bf1a97ffe58f2f6602f0f5ffe22b6fedc6 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-22  Rafael Espindola  <espindola@google.com>
+
+       * see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx
+       sharing.
+
 2008-05-22  H.J. Lu  <hongjiu.lu@intel.com>
 
        * defaults.h (UNITS_PER_SIMD_WORD): Add scalar mode as argument.
index 6e5260b995aa2ffaf62ac5cb5c42baefddb9f99a..96d7ff5aa4b1ae95b14adc6a47591bf2a583b03d 100644 (file)
--- a/gcc/see.c
+++ b/gcc/see.c
@@ -1686,7 +1686,7 @@ see_pre_insert_extensions (struct see_pre_extension_expr **index_map)
                edge eg = INDEX_EDGE (edge_list, e);
 
                start_sequence ();
-               emit_insn (PATTERN (expr->se_insn));
+               emit_insn (copy_insn (PATTERN (expr->se_insn)));
                se_insn = get_insns ();
                end_sequence ();
 
index e954cd5fa5919770fbbe1b95b2cb828180d7f183..2c62a499ce718abfb6e98712a7dcec9bc28a1b05 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-22  Rafael Espindola  <espindola@google.com>
+
+       * gcc.c-torture/compile/20080522-1.c: New testcase.
+
 2008-05-22  Richard Guenther  <rguenther@suse.de>
 
        * gcc.c-torture/execute/20080522-1.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080522-1.c b/gcc/testsuite/gcc.c-torture/compile/20080522-1.c
new file mode 100644 (file)
index 0000000..e259843
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile }
+/* { dg-options "-O2 -fsee" } */
+
+int f(const char* ptr, int bar) {
+  return (((const char *)0 - ptr ) & (bar - 1)) == 0;
+}
+
+
+int g(const char* ptr, const char *test, int N, int bar)  {
+  if (N == 0) {
+  }
+  else if (N > 0) {
+    int count = 0;
+    while ( count < N) {
+      if (!f(ptr, bar))
+        count++;
+    }
+  }
+  return f(test, bar) ;
+}