From 5e9f78cc748e907a69955f0b88fecf2686683843 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 29 Aug 2004 19:40:20 +0000 Subject: [PATCH] re PR rtl-optimization/16590 (Incorrect execution when compiling with -O2) 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 | 5 +++++ gcc/gcse.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/loop1.C | 24 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/opt/loop1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2138bf64bc5..b168aa32851 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-08-29 Mark Mitchell + + PR rtl-optimization/16590 + * gcse.c (pre_delete): Do not create invalid REG_EQUAL notes. + 2004-08-29 Diego Novillo * tree-ssa-ccp.c (ccp_visit_stmt): Remove #if 0 guards. diff --git a/gcc/gcse.c b/gcc/gcse.c index 16d76fe4d6c..0d602801594 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ada3528d9e2..4fcbd8b4438 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-29 Mark Mitchell + + PR rtl-optimization/16590 + * g++.dg/opt/loop1.C: New test. + 2004-08-29 Tobias Schlueter 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 index 00000000000..ad0308e7f95 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/loop1.C @@ -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 (); +} -- 2.30.2