public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/42230]  New: abi::__cxa_demangle fails to return the length of the decoded name
@ 2009-11-30 14:03 gcc at magfr dot user dot lysator dot liu dot se
  2009-11-30 15:29 ` [Bug libstdc++/42230] " paolo dot carlini at oracle dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: gcc at magfr dot user dot lysator dot liu dot se @ 2009-11-30 14:03 UTC (permalink / raw)
  To: gcc-bugs

When calling abi::__cxa_demangle("e", 0, &length, &cc) length is not updated
but the documentation indicates that it should be set to the length of the
demangled name.

It seems that this change was introduced after 3.4.6


-- 
           Summary: abi::__cxa_demangle fails to return the length of the
                    decoded name
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at magfr dot user dot lysator dot liu dot se
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug libstdc++/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
@ 2009-11-30 15:29 ` paolo dot carlini at oracle dot com
  2009-12-04 16:20 ` [Bug other/42230] " paolo dot carlini at oracle dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-11-30 15:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-11-30 15:29 -------
Ian, can you have a look to this issue? Thanks in advance.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iant at google dot com


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
  2009-11-30 15:29 ` [Bug libstdc++/42230] " paolo dot carlini at oracle dot com
@ 2009-12-04 16:20 ` paolo dot carlini at oracle dot com
  2010-01-09 19:08 ` paolo dot carlini at oracle dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-04 16:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-12-04 16:20 -------
I'm recategorizing as other, because actually the demangler doesn't belong to
the library.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |other


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
  2009-11-30 15:29 ` [Bug libstdc++/42230] " paolo dot carlini at oracle dot com
  2009-12-04 16:20 ` [Bug other/42230] " paolo dot carlini at oracle dot com
@ 2010-01-09 19:08 ` paolo dot carlini at oracle dot com
  2010-01-09 20:32 ` hjl dot tools at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-09 19:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2010-01-09 19:08 -------
Maybe HJ is interested...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (2 preceding siblings ...)
  2010-01-09 19:08 ` paolo dot carlini at oracle dot com
@ 2010-01-09 20:32 ` hjl dot tools at gmail dot com
  2010-01-09 20:51 ` paolo dot carlini at oracle dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-09 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl dot tools at gmail dot com  2010-01-09 20:32 -------
Please provide a testcase.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (3 preceding siblings ...)
  2010-01-09 20:32 ` hjl dot tools at gmail dot com
@ 2010-01-09 20:51 ` paolo dot carlini at oracle dot com
  2010-01-09 21:03 ` ian at airs dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-09 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo dot carlini at oracle dot com  2010-01-09 20:51 -------
I have in front of me the documentation in cxxabi.h and something like the
below should pass, AFAICS:

#include <cxxabi.h>
#include <cassert>
#include <cstddef>

int main()
{
  std::size_t length = 0;
  int cc;

  char* ret = abi::__cxa_demangle("e", 0, &length, &cc);

  assert( (cc < 0 && !ret) || (ret && length) );
}


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo dot carlini at oracle
                   |                            |dot com
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-09 20:51:05
               date|                            |


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (4 preceding siblings ...)
  2010-01-09 20:51 ` paolo dot carlini at oracle dot com
@ 2010-01-09 21:03 ` ian at airs dot com
  2010-01-09 21:05 ` paolo dot carlini at oracle dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ian at airs dot com @ 2010-01-09 21:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ian at airs dot com  2010-01-09 21:03 -------
As far as I can see, that does pass.

Note that the returned length is not the length of the demangled string, it is
the length of the allocated buffer.  That is, it may be larger than the length
of the demangled string.


-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (5 preceding siblings ...)
  2010-01-09 21:03 ` ian at airs dot com
@ 2010-01-09 21:05 ` paolo dot carlini at oracle dot com
  2010-01-09 21:15 ` ian at airs dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-09 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo dot carlini at oracle dot com  2010-01-09 21:04 -------
Doesn't pass for me. I don't have a special setup, a current, widespread
desktop Linux system.


-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (6 preceding siblings ...)
  2010-01-09 21:05 ` paolo dot carlini at oracle dot com
@ 2010-01-09 21:15 ` ian at airs dot com
  2010-01-09 21:29 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ian at airs dot com @ 2010-01-09 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ian at airs dot com  2010-01-09 21:15 -------
Oh sorry, I think the version I tested with was too old.  I think this broke
with Simon's patch of 2007-01-29.  I bet this patch fixes it:

Index: cp-demangle.c
===================================================================
--- cp-demangle.c       (revision 155776)
+++ cp-demangle.c       (working copy)
@@ -4777,7 +4777,7 @@ d_demangle (const char *mangled, int opt
       return NULL;
     }

-  *palc = dgs.allocation_failure ? 1 : 0;
+  *palc = dgs.allocation_failure ? 1 : dgs.alc;
   return dgs.buf;
 }



-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (7 preceding siblings ...)
  2010-01-09 21:15 ` ian at airs dot com
@ 2010-01-09 21:29 ` paolo dot carlini at oracle dot com
  2010-01-09 21:55 ` hjl dot tools at gmail dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-09 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from paolo dot carlini at oracle dot com  2010-01-09 21:29 -------
Thanks. The change would be also fully consistent with cplus_demangle_print. If
regtesting is fine it almost qualifies as trivial, I would say... HJ, are you
willing to prepare and test a complete patch?


-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (8 preceding siblings ...)
  2010-01-09 21:29 ` paolo dot carlini at oracle dot com
@ 2010-01-09 21:55 ` hjl dot tools at gmail dot com
  2010-01-09 22:34 ` ian at airs dot com
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-09 21:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from hjl dot tools at gmail dot com  2010-01-09 21:54 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00458.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2010-
                   |                            |01/msg00458.html


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (9 preceding siblings ...)
  2010-01-09 21:55 ` hjl dot tools at gmail dot com
@ 2010-01-09 22:34 ` ian at airs dot com
  2010-01-10  0:25 ` hjl at gcc dot gnu dot org
  2010-01-10  1:40 ` paolo dot carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: ian at airs dot com @ 2010-01-09 22:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from ian at airs dot com  2010-01-09 22:33 -------
The patch is OK if it passes testing.  Thanks.


-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (10 preceding siblings ...)
  2010-01-09 22:34 ` ian at airs dot com
@ 2010-01-10  0:25 ` hjl at gcc dot gnu dot org
  2010-01-10  1:40 ` paolo dot carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-01-10  0:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from hjl at gcc dot gnu dot org  2010-01-10 00:25 -------
Subject: Bug 42230

Author: hjl
Date: Sun Jan 10 00:24:52 2010
New Revision: 155785

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155785
Log:
Return dgs.alc on success

libiberty/

2010-01-09  Ian Lance Taylor  <iant@google.com>

        PR other/42230
        * cp-demangle.c (d_demangle): Return dgs.alc on success.

libstdc++-v3/

2010-01-09  H.J. Lu  <hongjiu.lu@intel.com>

        PR other/42230
        * testsuite/abi/pr42230.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/abi/pr42230.cc
Modified:
    trunk/libiberty/ChangeLog
    trunk/libiberty/cp-demangle.c
    trunk/libstdc++-v3/ChangeLog


-- 


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


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

* [Bug other/42230] abi::__cxa_demangle fails to return the length of the decoded name
  2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
                   ` (11 preceding siblings ...)
  2010-01-10  0:25 ` hjl at gcc dot gnu dot org
@ 2010-01-10  1:40 ` paolo dot carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-10  1:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from paolo dot carlini at oracle dot com  2010-01-10 01:39 -------
Fixed for 4.5.0.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-30 14:03 [Bug libstdc++/42230] New: abi::__cxa_demangle fails to return the length of the decoded name gcc at magfr dot user dot lysator dot liu dot se
2009-11-30 15:29 ` [Bug libstdc++/42230] " paolo dot carlini at oracle dot com
2009-12-04 16:20 ` [Bug other/42230] " paolo dot carlini at oracle dot com
2010-01-09 19:08 ` paolo dot carlini at oracle dot com
2010-01-09 20:32 ` hjl dot tools at gmail dot com
2010-01-09 20:51 ` paolo dot carlini at oracle dot com
2010-01-09 21:03 ` ian at airs dot com
2010-01-09 21:05 ` paolo dot carlini at oracle dot com
2010-01-09 21:15 ` ian at airs dot com
2010-01-09 21:29 ` paolo dot carlini at oracle dot com
2010-01-09 21:55 ` hjl dot tools at gmail dot com
2010-01-09 22:34 ` ian at airs dot com
2010-01-10  0:25 ` hjl at gcc dot gnu dot org
2010-01-10  1:40 ` paolo dot carlini at oracle dot com

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).