public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/28797]  New: Problems with demangling (__cxa_demangle())
@ 2006-08-22  3:57 kurkov at gorodok dot net
  2006-08-22  5:21 ` [Bug other/28797] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kurkov at gorodok dot net @ 2006-08-22  3:57 UTC (permalink / raw)
  To: gcc-bugs

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])
_Z1fILi2EEvRAplplT_Li3ELi1E_i -> void f<2>(int (&) [((2) + (3)) + (1)]), should
be: void f<2>(int (&) [((2)+(3))+(1)])
_Z1fM1AKiPKS1_ -> _Z1fM1AKiPKS1_, should be: f(int const A::*, int const A::*
const*)
_Z3absILd1c1f1496f8a44219EEvv -> void abs<(double)[1c1f1496f8a44219]>(), should
be: void abs<3.14159e-173>()
_Z3absILd40092acd9e83e426EEvv -> void abs<(double)[40092acd9e83e426]>(), should
be: void abs<3.1459>()                  
_Z3absILe08042191a6cc56a2fe117becEEvv -> void abs<(long
double)[08042191a6cc56a2fe117bec]>(), should be: void abs<1.234e-2345l>()
_Z3absILe804bfff8000000000000000EEvv -> void abs<(long
double)[804bfff8000000000000000]>(), should be: void abs<-1l>()                 
_Z3absILf4016147bEEvv -> void abs<(float)[4016147b]>(), should be: void
abs<2.345f>()                   
_Z3absILfc1800000EEvv -> void abs<(float)[c1800000]>(), should be: void
abs<-16f>()                     
_Z3fooA30_A_i -> foo(int [30][]), should be: foo(int[30][])
_Z9function1PVKiPViPKiPi -> function1(int const volatile*, int volatile*, int
const*, int*), should be: function1(int volatile const*, int volatile*, int
const*, int*)
_Z9function2PVKiPViPKiRS_RS1_RS3_ -> function2(int const volatile*, int
volatile*, int const*, int const volatile&, int volatile&, int const&), should
be: function2(int volatile const*, int volatile*, int const*, int volatile
const&, int volatile&, int const&)
_Z9function4PVKi -> function4(int const volatile*), should be: function4(int
volatile const*)
_Z9function5PVKi -> function5(int const volatile*), should be: function5(int
volatile const*)
_Z9function6PVKiS0_ -> function6(int const volatile*, int const volatile*),
should be: function6(int volatile const*, int volatile const*)
_Z9functionjj -> functionj(unsigned int), should be functionj(unsigned)
_ZlsRKU3fooU4bart1XS0_ -> operator<<(X bart foo const&, X bart), should be:
operator<<(X const foo bart&, X const foo bart)
_ZN3FooIA4_iE3barE -> Foo<int [4]>::bar, should be: Foo<int[4]>::bar
_Znaj -> operator new[](unsigned int), should be: operator new[](unsigned)
_ZngILi42EEvN1AIXplT_Li2EEE1TE -> void operator-<42>(A<(42) + (2)>::T), should
be: void operator-<42>(A<(42)+(2)>::T)
_ZngILi42EEvN1AIXplT_Li2EEEE -> void operator-<42>(A<(42) + (2)>), should be:
void operator-<42>(A<(42)+(2)>)
_ZNSsC1EPKcRKSaIcE -> std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(char const*, std::allocator<char> const&),
should be: std::string::string(char const*, std::allocator<char> const&)
_Znwj -> operator new(unsigned int), should be: operator new(unsigned)
_ZTv0_n16_NSoD0Ev -> virtual thunk to std::basic_ostream<char,
std::char_traits<char> >::~basic_ostream(), should be: virtual thunk to
std::ostream::~ostream()

These issues you can reproduce on Mac OS, IA32 Linux and EM64T Linux

Environment: IA32 and EM64T Linux: Red Hat Enterprise Linux WS release 4
(Nahant Update 3); Release: gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)

Environment: Mac OS
Release: 
gcc -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5341.obj~1/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=powerpc-apple-darwin8 --with-arch=pentium-m --with-tune=prescott
--program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5341)

How-To-Repeat:
Feed those mangled names to __cxa_demangle() function and check the results of
demangling.

This report is very close to Bug#:7986.


-- 
           Summary: Problems with demangling (__cxa_demangle())
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kurkov at gorodok dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
@ 2006-08-22  5:21 ` pinskia at gcc dot gnu dot org
  2006-08-22  5:26 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-22  5:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-22 05:21 -------
_Z1fA37_iPS_ -> f(int [37], int (*) [37]), should be: f(int[37], int (*) [37])
Isn't that just a space?

_Z1fILi2EEvRAplplT_Li3ELi1E_i -> void f<2>(int (&) [((2) + (3)) + (1)]), should
be: void f<2>(int (&) [((2)+(3))+(1)])

Likewise?

_Z3fooA30_A_i -> foo(int [30][]), should be: foo(int[30][])

Likewise?

_Z9function1PVKiPViPKiPi -> function1(int const volatile*, int volatile*, int
const*, int*), should be: function1(int volatile const*, int volatile*, int
const*, int*)

The older of the volatile and const does not matter so why is this a problem?

_Z9functionjj -> functionj(unsigned int), should be functionj(unsigned)

unsigned == unsigned int so why is this a problem?

_ZTv0_n16_NSoD0Ev -> virtual thunk to std::basic_ostream<char,
std::char_traits<char> >::~basic_ostream(), should be: virtual thunk to
std::ostream::~ostream()

no, it is still basic_ostream<char, std::char_traits<char> > technicially.


And some more space issues.

The double ones are weird, maybe we should print out the C99 hex float instead,
there is a bug about this before too.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
  2006-08-22  5:21 ` [Bug other/28797] " pinskia at gcc dot gnu dot org
@ 2006-08-22  5:26 ` pinskia at gcc dot gnu dot org
  2006-08-22  5:52 ` kurkov at gorodok dot net
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-22  5:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-22 05:26 -------
(In reply to comment #1)
> The double ones are weird, maybe we should print out the C99 hex float instead,
> there is a bug about this before too.

See PR 13045, there is most likely more discussion about this.   The other
issue is that demangling for floats are hard between different targets because
of different floating point formats.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
  2006-08-22  5:21 ` [Bug other/28797] " pinskia at gcc dot gnu dot org
  2006-08-22  5:26 ` pinskia at gcc dot gnu dot org
@ 2006-08-22  5:52 ` kurkov at gorodok dot net
  2006-08-24  6:20 ` ian at airs dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kurkov at gorodok dot net @ 2006-08-22  5:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kurkov at gorodok dot net  2006-08-22 05:52 -------
(In reply to comment #1)
Sorry for space and unsigned int issues, I should just correct compare files
for my test.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (2 preceding siblings ...)
  2006-08-22  5:52 ` kurkov at gorodok dot net
@ 2006-08-24  6:20 ` ian at airs dot com
  2006-08-25  8:50 ` kurkov at gorodok dot net
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-08-24  6:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ian at airs dot com  2006-08-24 06:20 -------
Where did you get your list of symbol names and demangled strings?

As Andrew has pointed out, there seem to be a few different issues here:
different spacing, different qualifier order, different handling of floating
point constants.  It may well be appropriate to change gcc's demangler, but in
my opinion these different issues should be handled as different problem
reports.

Other than those issues, I see one serious issue in this list: _Z1fM1AKiPKS1_,
which the gcc demangler does not demangle, but you propose should be demangled
as f(int const A::*, int const A::*const*).  I have to agree with you that
there appears to be something wrong with the demangler in this case.  It is
related to the long comment in d_pointer_to_member_type in cp-demangle.c.  When
I wrote that comment I believed that it was correct.  However, it appears to
now be incorrect.  I haven't yet been able to track down the change to gcc
which affected this.  It is also possible that I was simply mistaken.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|ian at gcc dot gnu dot org  |ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (3 preceding siblings ...)
  2006-08-24  6:20 ` ian at airs dot com
@ 2006-08-25  8:50 ` kurkov at gorodok dot net
  2006-08-26 18:54 ` ian at airs dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kurkov at gorodok dot net @ 2006-08-25  8:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kurkov at gorodok dot net  2006-08-25 08:50 -------
(In reply to comment #4)
> Where did you get your list of symbol names and demangled strings?
My program uses C standard I/O routines instead of iostreams, to support
new-ABI C++ compilers that do not have complete C++ standard library
implementations.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (4 preceding siblings ...)
  2006-08-25  8:50 ` kurkov at gorodok dot net
@ 2006-08-26 18:54 ` ian at airs dot com
  2006-08-26 19:04 ` ian at airs dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-08-26 18:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ian at airs dot com  2006-08-26 18:54 -------
OK, so that's where you got your symbols, but where did you get your list of
demangled strings?  Did you just compare directly to the source code?  Or are
you using some other demangler?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (5 preceding siblings ...)
  2006-08-26 18:54 ` ian at airs dot com
@ 2006-08-26 19:04 ` ian at airs dot com
  2006-08-27 21:43 ` ian at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-08-26 19:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ian at airs dot com  2006-08-26 19:04 -------
I am testing a patch to the demangler to correctly handle _Z1fM1AKiPKS1_.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ian at airs dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-26 19:04:39
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (6 preceding siblings ...)
  2006-08-26 19:04 ` ian at airs dot com
@ 2006-08-27 21:43 ` ian at gcc dot gnu dot org
  2006-08-27 21:44 ` ian at airs dot com
  2007-01-10 19:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: ian at gcc dot gnu dot org @ 2006-08-27 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ian at gcc dot gnu dot org  2006-08-27 21:43 -------
Subject: Bug 28797

Author: ian
Date: Sun Aug 27 21:42:55 2006
New Revision: 116493

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116493
Log:
        PR other/28797
        * cp-demangle.c (d_pointer_to_member_type): Do add a substitution
        for a qualified member which is not a function.
        * testsuite/demangle-expected: Add test case.

Modified:
    trunk/libiberty/ChangeLog
    trunk/libiberty/cp-demangle.c
    trunk/libiberty/testsuite/demangle-expected


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (7 preceding siblings ...)
  2006-08-27 21:43 ` ian at gcc dot gnu dot org
@ 2006-08-27 21:44 ` ian at airs dot com
  2007-01-10 19:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-08-27 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from ian at airs dot com  2006-08-27 21:44 -------
I'm going to close this PR since I just fixed the only real problem that I see
here.  If you see other problems with the demangler, please open a separate PR
for each problem.

Thanks for reporting the bug.


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug other/28797] Problems with demangling (__cxa_demangle())
  2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
                   ` (8 preceding siblings ...)
  2006-08-27 21:44 ` ian at airs dot com
@ 2007-01-10 19:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-10 19:40 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28797


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-01-10 19:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-22  3:57 [Bug libstdc++/28797] New: Problems with demangling (__cxa_demangle()) kurkov at gorodok dot net
2006-08-22  5:21 ` [Bug other/28797] " pinskia at gcc dot gnu dot org
2006-08-22  5:26 ` pinskia at gcc dot gnu dot org
2006-08-22  5:52 ` kurkov at gorodok dot net
2006-08-24  6:20 ` ian at airs dot com
2006-08-25  8:50 ` kurkov at gorodok dot net
2006-08-26 18:54 ` ian at airs dot com
2006-08-26 19:04 ` ian at airs dot com
2006-08-27 21:43 ` ian at gcc dot gnu dot org
2006-08-27 21:44 ` ian at airs dot com
2007-01-10 19:40 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).