Bug 36046 - Demangler fails on templates with non-type reference parameters
Summary: Demangler fails on templates with non-type reference parameters
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-25 13:54 UTC by Jens Kilian
Modified: 2008-05-05 05:28 UTC (History)
2 users (show)

See Also:
Host: x86_64-redhat-linux
Target: x86_64-redhat-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-04-26 00:22:12


Attachments
Test case. (427 bytes, text/plain)
2008-04-25 13:57 UTC, Jens Kilian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Kilian 2008-04-25 13:54:44 UTC
See attached test case.
Comment 1 Jens Kilian 2008-04-25 13:57:12 UTC
Created attachment 15531 [details]
Test case.
Comment 2 Wolfgang Bangerth 2008-04-26 00:22:12 UTC
Confirmed. The demangler gets a valid symbol it can't demangle.
W.
Comment 3 Wolfgang Bangerth 2008-04-26 00:25:54 UTC
By the way, the return code of __cxa_demangle is
  -2: mangled_name is not a valid name under the C++ ABI mangling rules.
as per 
  http://docs.mandragor.org/files/Programming_languages/Cpp/libstdcpp_v3_Source_Documentation/namespaceabi.html

The string that can't be demangled is "3barILZ3bazEE".

W.
Comment 4 Andrew Pinski 2008-04-26 00:39:47 UTC
This is expected, we should not be demangling types with __cxa_demangle.
Comment 5 Andrew Pinski 2008-04-26 00:47:28 UTC
Ok, this is a generic demangler issue, we don't demangle _Z1f3barILZ3bazEE either.
Which is f(bar<baz>) but only because it is mangled incorrectly in the first place.

So the real issue here is that the demangle only handles correctly mangled names.
_Z1f3barIL_Z3bazEE is the correct mangling.
Comment 6 Andrew Pinski 2008-04-26 00:53:05 UTC
so all three versions mangle it differently
if we have f(bar<baz>)
1: _Z1f3barIXadL_Z3bazEEE
2: _Z1f3barILZ3bazEE
3: _Z1f3barIL_Z3bazEE
I think 3 is correct as the underscore is needed and the address is not supplied..

but the default value is 2 right now

I don't know if we should "fix" up the mangler to accept version 2 at all.
Comment 7 Ian Lance Taylor 2008-04-26 00:57:53 UTC
See bug #16240 for some background.
Comment 8 Andrew Pinski 2008-05-05 05:28:41 UTC
As mentioned in the other bug report, it is hard to handle the -fabi-version=2 version of the mangled string.  We handle correctly the correctly mangled already.

So closing as won't fix.