Bug 7986 - Problems with demangling (__cxa_demangle())
Summary: Problems with demangling (__cxa_demangle())
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Benjamin Kosnik
Depends on:
Reported: 2002-09-20 04:46 UTC by johnb
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description johnb 2002-09-20 04:46:00 UTC
I used a simple program which calls __cxa_demangle function. These mangled names were demangled wrong:
_Z1fA37_iPS_ -> f(int[37], int[37]*), should be: f(int[37], int (*) [37])
_Z1fM1AFivEPS0_ -> f(int (A::*)(), int ()()*), should be: f(int (A::*)(), int (*)())
_Z1fPFPA1_ivE -> f(int (*) [1] (*)()), should be: f(int (*(*)()) [1])
_Z1fPKM1AFivE -> f(int (A::*)() const*), should be: f(int (A::* const*)())
_Z1jM1AFivEPS1_ -> j(int (A::*)(), int (A::*)()*), should be: j(int (A::*)(), int (A::**)())
_Z1sPA37_iPS0_ -> s(int (*) [37], int (*) [37]*), should be: s(int (*) [37], int (**) [37])
_Z3fooA30_A_i -> foo(int[][30]), should be: foo(int[30][])
_Z3kooPA28_A30_i -> koo(int[30] (*) [28]), should be: koo(int (*) [28][30])
_ZlsRKU3fooU4bart1XS0_ -> operator<<(foo bart X const&, bart X), should be: operator<<(X const foo bart&, X const foo bart)

And in these cases __cxa_demangle() returned -2 (Invalid mangled name):
_Z1fM1AKFivE -> _Z1fM1AKFivE, should be: f(int (A::*)() const)
_Z3absILd1c1f1496f8a44219EEvv -> _Z3absILd1c1f1496f8a44219EEvv, should be: void abs<3.14159e-173>()
_Z3absILd40092acd9e83e426EEvv -> _Z3absILd40092acd9e83e426EEvv, should be: void abs<3.1459>()
_Z3absILe08042191a6cc56a2fe117becEEvv -> _Z3absILe08042191a6cc56a2fe117becEEvv, should be: void abs<1.234e-2345l>()
_Z3absILe804bfff8000000000000000EEvv -> _Z3absILe804bfff8000000000000000EEvv, should be: void abs<-1l>()
_Z3absILf4016147bEEvv -> _Z3absILf4016147bEEvv, should be: void abs<2.345f>()
_Z3absILfc1800000EEvv -> _Z3absILfc1800000EEvv, should be: void abs<-16f>()

gcc 3.2, gcc 3.1

Red Hat Linux 8.0beta

Feed those mangled names to __cxa_demangle() function and check the results of demangling.
Comment 1 Benjamin Kosnik 2002-11-05 15:42:06 UTC
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-Why: Mine.
Comment 2 Benjamin Kosnik 2002-11-05 15:42:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: How do you find this stuff?
    These are all confirmed bugs. There was some work done to 
    fix these problems in the demangler, but it was abandonded. At some point, this work will resume, or the current demangling code will be replaced. 
Comment 3 Benjamin Kosnik 2003-02-27 19:31:13 UTC
State-Changed-From-To: analyzed->feedback
State-Changed-Why: Fixed in mainline.
Comment 4 Nathanael C. Nerode 2003-02-28 00:13:23 UTC
State-Changed-From-To: feedback->closed
State-Changed-Why: Fixed in mainline = closed != feedback.