From 4799e6aa58eab27112b27c9ca328f57430f8d1ab Mon Sep 17 00:00:00 2001 From: Rafael Avila de Espindola Date: Thu, 22 May 2008 15:49:30 +0000 Subject: [PATCH] see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx sharing. * 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 | 5 +++++ gcc/see.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ .../gcc.c-torture/compile/20080522-1.c | 20 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20080522-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50754f75dbe..8e6029bf1a9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-05-22 Rafael Espindola + + * see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx + sharing. + 2008-05-22 H.J. Lu * defaults.h (UNITS_PER_SIMD_WORD): Add scalar mode as argument. diff --git a/gcc/see.c b/gcc/see.c index 6e5260b995a..96d7ff5aa4b 100644 --- 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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e954cd5fa59..2c62a499ce7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-05-22 Rafael Espindola + + * gcc.c-torture/compile/20080522-1.c: New testcase. + 2008-05-22 Richard Guenther * 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 index 00000000000..e2598439b79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080522-1.c @@ -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) ; +} -- 2.30.2