re PR rtl-optimization/16590 (Incorrect execution when compiling with -O2)
authorMark Mitchell <mark@codesourcery.com>
Sun, 29 Aug 2004 19:40:20 +0000 (19:40 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 29 Aug 2004 19:40:20 +0000 (19:40 +0000)
PR rtl-optimization/16590
* gcse.c (pre_delete): Do not create invalid REG_EQUAL notes.

PR rtl-optimization/16590
* g++.dg/opt/loop1.C: New test.

From-SVN: r86732

gcc/ChangeLog
gcc/gcse.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/loop1.C [new file with mode: 0644]

index 2138bf64bc53da994ceeb1e094d8659d0e714745..b168aa3285113a1e795f953dd3f67479652fa479 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-29  Mark Mitchell  <mark@codesourcery.com>
+
+       PR rtl-optimization/16590
+       * gcse.c (pre_delete): Do not create invalid REG_EQUAL notes.
+
 2004-08-29  Diego Novillo  <dnovillo@redhat.com>
 
        * tree-ssa-ccp.c (ccp_visit_stmt): Remove #if 0 guards.
index 16d76fe4d6c760cc9cfe9d9c7735f893ba347d43..0d602801594dab7dc803a3e02611d1fb03812568 100644 (file)
@@ -4463,7 +4463,9 @@ pre_delete (void)
                  expr->reaching_reg
                    = gen_reg_rtx (GET_MODE (SET_DEST (set)));
 
-               gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
+               emit_insn_after (gen_move_insn (SET_DEST (set), 
+                                               expr->reaching_reg), 
+                                insn);
                delete_insn (insn);
                occr->deleted_p = 1;
                SET_BIT (pre_redundant_insns, INSN_CUID (insn));
index ada3528d9e2dfe82502cf1c47037f84d1c9c69bb..4fcbd8b44385cd0d1c6cc41ad8d84dda8100dc8d 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-29  Mark Mitchell  <mark@codesourcery.com>
+
+       PR rtl-optimization/16590
+       * g++.dg/opt/loop1.C: New test.
+
 2004-08-29  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/13910
diff --git a/gcc/testsuite/g++.dg/opt/loop1.C b/gcc/testsuite/g++.dg/opt/loop1.C
new file mode 100644 (file)
index 0000000..ad0308e
--- /dev/null
@@ -0,0 +1,24 @@
+// PR rtl-optimization/16590
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort(); 
+struct iterator { 
+  char * p; 
+  int *dummy; 
+}; 
+static iterator pend(char * start) { 
+  iterator p = {start, 0}; 
+  if (p.p == start) p.p = start+5; 
+  --p.p; 
+  return p; 
+} 
+int main() { 
+  char mem[4+1]; 
+  if(pend(mem).p != mem+4) 
+    abort (); 
+}