From: Kenneth Zadeck Date: Sat, 10 May 2008 20:28:19 +0000 (+0000) Subject: re PR c++/36185 (wrong code with -O2 -fgcse-sm) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e00d96036348f05c40cad08f7baf2fcfb1cf33c;p=gcc.git re PR c++/36185 (wrong code with -O2 -fgcse-sm) 2008-05-10 Kenneth Zadeck * gcse.c (store_killed_in_insn): Negated call to RTL_CONST_CALL_P. 2008-05-10 Kenneth Zadeck PR rtl-optimization/36185 * g++.dg/opt/pr36185.C From-SVN: r135159 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b6b75215933..c01005769f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2008-05-10 Kenneth Zadeck + + * gcse.c (store_killed_in_insn): Negated call to RTL_CONST_CALL_P. + 2008-05-10 H.J. Lu * config/i386/i386.c (bdesc_ptest): Removed. diff --git a/gcc/gcse.c b/gcc/gcse.c index e881e86764e..77efc44769b 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -5987,7 +5987,7 @@ store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after) { /* A normal or pure call might read from pattern, but a const call will not. */ - if (RTL_CONST_CALL_P (insn)) + if (!RTL_CONST_CALL_P (insn)) return true; /* But even a const call reads its parameters. Check whether the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 395a041abe1..06bfdf40277 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,9 +1,17 @@ +<<<<<<< .mine +2008-05-10 Kenneth Zadeck + + PR rtl-optimization/36185 + * g++.dg/opt/pr36185.C + +======= 2008-05-10 Francois-Xavier Coudert * write_to_null.f90: Rename to write_to_null.F90. * write_to_null.F90: On Windows, "nul" is the equivalent of the Unix /dev/null. +>>>>>>> .r135158 2008-05-10 Richard Sandiford PR rtl-optimization/33642 diff --git a/gcc/testsuite/g++.dg/opt/pr36185.C b/gcc/testsuite/g++.dg/opt/pr36185.C new file mode 100644 index 00000000000..2ffa52f8e86 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr36185.C @@ -0,0 +1,24 @@ +// PR rtl-optimization/36185 +// { dg-do run } +// { dg-options "-O2 -fgcse-sm" } + +struct Base { + virtual ~Base() {} + virtual void f() = 0; +}; +struct Derived : Base { + Derived(); + virtual void f() {} +}; +struct Foo { + Foo(Base&); +}; +Derived::Derived() { + Foo foo(*this); +} +Foo::Foo(Base& base) { + base.f(); +} +int main() { + Derived d; +}