https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65062
Bug ID: 65062 Summary: [4.9 Regression] Miscompilation: invalid C++ mangled name for global variable Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thiago at kde dot org Code: template <class> void tf() { extern void (*qt_memfill32)(); qt_memfill32(); } void f() { tf<int>(); } When compiled with GCC 5.0, the object file has a reference to "_Z12qt_memfill32", which doesn't seem to me to be a valid C++ mangled name. At the very least, it's an ABI compatibility break with previous versions of GCC, other compilers and with itself. This symbol is defined in another .o as "qt_memfill32", even when compiled with GCC 5.0. Tests: gcc-5.0 -O2 -S -o - test.cpp: jmp *_Z12qt_memfill32(%rip) gcc-4.9 -O2 -S -o - test.cpp: movq qt_memfill32(%rip), %rax jmp *%rax clang-3.6 -O2 -S -o - test.cpp: jmpq *qt_memfill32(%rip) # TAILCALL icpc -O2 -S -o - test.cpp: movq qt_memfill32(%rip), %rax jmp *%rax