https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64346
Bug ID: 64346 Summary: gcc generates incorrect debug info for ctor/dtor Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dehao at gcc dot gnu.org #cat a.cc #include <iostream> #include <memory> class ABC { public: ABC() {printf("abc\n");} ~ABC() {printf("xyz\n");} }; int foo() { std::unique_ptr<ABC> a(new ABC()); } #g++4.8 a.cc -c -O2 -std=c++11 -g -fno-exceptions #addr2line -e a.o -i -f 0x13 _ZN3ABCC1Ev /usr/local/google/home/dehao/gcc/gcc-4_9/debug/a.cc:5 _Z3foov /usr/local/google/home/dehao/gcc/gcc-4_9/debug/a.cc:10 #g++4.9 a.cc -c -O2 -std=c++11 -g -fno-exceptions #addr2line -e a.o -i -f 0x13 _ZN3ABCC4Ev /usr/local/google/home/dehao/gcc/gcc-4_9/debug/a.cc:5 _Z3foov /usr/local/google/home/dehao/gcc/gcc-4_9/debug/a.cc:10 #g++4.9 a.cc -c -O0 -std=c++11 -g -fno-exceptions #nm a.o |grep ABCC 0000000000000000 W _ZN3ABCC1Ev 0000000000000000 W _ZN3ABCC2Ev 0000000000000000 n _ZN3ABCC5Ev Note that for the gcc 4.9 version and later, without any optimization _ZN3ABCC4Ev does not exists in the symbol table. So we expect either _ZN3ABCC1Ev or _ZN3ABCC2Ev in the addr2line result.