http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49258
--- Comment #6 from licheng.1212 at gmail dot com <licheng.1212 at gmail dot com> 2012-04-09 11:14:56 UTC --- (In reply to comment #5) > (In reply to comment #4) > > Yes,but why we can't remove the function notused() form vtable, since this > > function will never used. > > How can you tell? Without the full exectuable and knowing the entry point, > there is no way (-fwhole-program can help but it becomes a turning machine at > that point). class hello{ public void notused() { System.out.println("not used"); } public static void main(String argv[]) { System.out.println("Hello"); } } this is a full execlutable program,and it hava only one entry point "main"! and i test a c++ file,it will remove the unused funcitons "notused": [licheng@Soft04 ~]$ cat hello.cpp #include <iostream> class hello { public: hello() { } void notused() { std::cout << "not used"; } void used() { std::cout << "used"; } ~hello() { } }hi; int main() { hello t; t.used(); return 0; } [licheng@Soft04 ~]$