Bug 17157 - GDB segfault when demangling symbol
Summary: GDB segfault when demangling symbol
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.7
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2014-07-14 18:24 UTC by sourceware
Modified: 2024-01-02 16:18 UTC (History)
2 users (show)

See Also:
Last reconfirmed:

Repro-Case (242 bytes, text/x-csrc)
2014-07-14 18:24 UTC, sourceware

Note You need to log in before you can comment on or make changes to this bug.
Description sourceware 2014-07-14 18:24:01 UTC
Created attachment 7712 [details]

The following symbol fails to demangle with GDB 7.7.1 (built from source.) Comes from Code compiled with GCC 4.8.2 on Ubuntu 14.04. Also fails on distro-provided GDB (7.7.)


c++filt correctly demangles this to:

std::enable_if<std::is_arithmetic<float>::value, niven::Color<decltype (((float)())*((float)())), 4> const>::type niven::Color<float, 4>::operator/<float>(float) const

For the repro-case, assuming it has been put into the GDB source root directory and GDB is built, use: gcc -Iinclude/ test.c ./libiberty/libiberty.a -o test
Comment 1 Gary Benson 2014-07-15 08:39:47 UTC
Confirmed and filed as:
Comment 2 sourceware 2014-12-12 20:08:36 UTC
Ok, this problem is a bit more complicated. First, a newer GCC (4.9.1) and Clang 3.5 doesn't produce the symbol any more. Running a more recent c++filt on it now crashes c++filt -- if you look closely, the originally demangled type was also incorrect, as: decltype (((float)()*(float)())) does not make sense -- should have been decltype (float ()*float ()) which is simply float.

I'm debugging a new crash now where the demangler/libiberty starts producing a symbol name with decltype in it, which I strongly suspect is similar to the original issue. Am I right to assume that decltype is never part of a mangled symbol name?
Comment 3 Gary Benson 2014-12-19 13:04:47 UTC
It might be best to add your comments to the GCC bug above, it's more likely to be seen by those with the right kind of expertise.
Comment 4 Hannes Domani 2024-01-02 16:18:23 UTC
Was fixed on gcc side some time ago.