https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117578
Bug ID: 117578 Summary: cxa_demangle cannot deal with long names Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jengelh at inai dot de Target Milestone: --- Version: gcc version 15.0.0 20241111 (experimental) (SUSE Linux) == Input (x.cpp) == template<const char *...> struct FFF { unsigned int memb = 0; }; struct HHH { HHH(); static constexpr char spicyeight[] = ""; FFF< spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight > id; }; HHH::HHH() {} == Observed output == g++ -c x.cpp nm -C x.o 0000000000000000 W _ZN3FFFIJXadL_ZN3HHH10spicyeigh... ... 0000000000000000 T HHH::HHH() == Expected output == 0000000000000000 W FFF<<anonymous> >::FFF() [with const char* ...<anonymous> = {(& HHH::spicyeight)...}] To verify that my /usr/bin/nm isn't having a too-old copy of cp-demangle, let's invoke cxa_demangle from the current g++ libstdc++ directly: == Input (y.cpp) == #include <cstdio> #include <cxxabi.h> template<const char *...> struct FFF { FFF() { printf("Pretty: %s\n", __PRETTY_FUNCTION__); } unsigned int memb = 0; }; struct HHH { HHH(); static constexpr char spicyeight[] = ""; FFF< spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight, spicyeight > id; }; HHH::HHH() {} int main() { HHH h; char buf[1024]; size_t bufsize = sizeof(buf); int status = 0; __cxxabiv1::__cxa_demangle("_ZN3FFFIJXadL_ZN3HHH10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEXadL_ZNS0_10spicyeightEEEEEC1Ev", buf, &bufsize, &status); printf("Via demangle: %s (%d)\n", buf, status); } == Observed == Pretty: FFF<<anonymous> >::FFF() [with const ..... Via demangle: (-2)