[Bug c++/59883] Missed C++ front-end devirtualizations
hubicka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 29 20:41:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59883
--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The self-recursion testcase is wrong, as can be seen by the following testcase:
#include <stdio.h>
struct A
{
virtual int foo (void) {return foo()+1;}
};
struct B: public A
{
virtual int foo (void) {return 1;}
};
main()
{
struct B b;
printf("%i\n",b.A::foo());
}
Still, given that recursive virtual functions seems frequent, I wonder if we
can't
try to track such explicit calls that breaks the assumption that a virtual
function is called only for derived types that do not overwrite it and try to
optimize at least for local functions...
More information about the Gcc-bugs
mailing list