public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI
@ 2003-11-02  0:05 rmerkert at alphatech dot com
  2003-11-02  1:10 ` [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI rmerkert at alphatech dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rmerkert at alphatech dot com @ 2003-11-02  0:05 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: __cxa_demangle not working as specified in ABI
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rmerkert at alphatech dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc (GCC) 3.4 20031026 (experimental)

This test program produces different results for 3.3.2 and 3.4.

cat > test.c <<EOF
#include <stdio.h>
#include <stdlib.h>

extern char *__cxa_demangle (const char *__mangled_name,
                             char *__output_buffer,
                             __SIZE_TYPE__ *__length,
                             int *__status);


int main(int argc, char** argv)
{
  for (int i=1;i<argc;++i) {
    int status;
    char* res = __cxa_demangle(argv[i],0,0,&status);
    if (res!=NULL || status!=0) {
      printf("Demangled '%s' as '%s'\n",argv[i],res);
    }
    else {
      printf("Could not demangle '%s'\n",argv[i]);
    }
    free(res);
  }
  return 0;
}

EOF

/local/gcc/bin/gcc -o test test.c -std=c99 /local/gcc/lib/libstdc++.a

'./test hello'

produces

Demangled 'hello' as 'unsigned char'

Also, if I don't pass the status flag pointer, then  I get 

Could not demangle 'hello'


Code is working in mainline, but it would be nice to have it work in 3.3
release series as well. 

Can this be backported?


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

* [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI
  2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
@ 2003-11-02  1:10 ` rmerkert at alphatech dot com
  2003-11-02  1:11 ` rmerkert at alphatech dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rmerkert at alphatech dot com @ 2003-11-02  1:10 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rmerkert at alphatech dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__cxa_demangle not working  |__cxa_demangle not working
                   |as specified in ABI         |as specified in 3.3.2 ABI


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

* [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI
  2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
  2003-11-02  1:10 ` [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI rmerkert at alphatech dot com
@ 2003-11-02  1:11 ` rmerkert at alphatech dot com
  2003-11-02  2:21 ` carlo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rmerkert at alphatech dot com @ 2003-11-02  1:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


rmerkert at alphatech dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|gcc (GCC) 3.4 20031026      |gcc (GCC) 3.3.2
                   |(experimental)              |


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

* [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI
  2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
  2003-11-02  1:10 ` [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI rmerkert at alphatech dot com
  2003-11-02  1:11 ` rmerkert at alphatech dot com
@ 2003-11-02  2:21 ` carlo at gcc dot gnu dot org
  2003-11-02 21:58 ` [Bug libstdc++/12873] [3.3 only] " pinskia at gcc dot gnu dot org
  2003-12-05  7:04 ` bkoz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-02  2:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


carlo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-02 02:21:55
               date|                            |


------- Additional Comments From carlo at gcc dot gnu dot org  2003-11-02 02:21 -------
The demangler in 3.4 is a complete rewrite, it cannot be
back ported.  What needs to be fixed here is that the
__cxa_demangle implementation in 3.3

1) Doesn't take the string length of the input into account
   (ie, it demangles what it can and ignores any trailing
    characters).  It should fail if any characters are trailing.
2) A single character should NOT be considered to be a mangled
   type name (a builtin-type) - but returned as-is.

Instead, it demangles the 'h' and ignores the rest.

I am afraid I have no time to write patches for the 3.3 branch,
but I am sure this would be a small patch.


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

* [Bug libstdc++/12873] [3.3 only] __cxa_demangle not working as specified in 3.3.2 ABI
  2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
                   ` (2 preceding siblings ...)
  2003-11-02  2:21 ` carlo at gcc dot gnu dot org
@ 2003-11-02 21:58 ` pinskia at gcc dot gnu dot org
  2003-12-05  7:04 ` bkoz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-02 21:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__cxa_demangle not working  |[3.3 only] __cxa_demangle
                   |as specified in 3.3.2 ABI   |not working as specified in
                   |                            |3.3.2 ABI
   Target Milestone|---                         |3.3.3


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

* [Bug libstdc++/12873] [3.3 only] __cxa_demangle not working as specified in 3.3.2 ABI
  2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
                   ` (3 preceding siblings ...)
  2003-11-02 21:58 ` [Bug libstdc++/12873] [3.3 only] " pinskia at gcc dot gnu dot org
@ 2003-12-05  7:04 ` bkoz at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2003-12-05  7:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2003-12-05 07:04 -------

The 3.3.x __cxa_demangle code is considered broken. It's been re-written a
couple of times now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


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


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

end of thread, other threads:[~2003-12-05  7:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-02  0:05 [Bug libstdc++/12873] New: __cxa_demangle not working as specified in ABI rmerkert at alphatech dot com
2003-11-02  1:10 ` [Bug libstdc++/12873] __cxa_demangle not working as specified in 3.3.2 ABI rmerkert at alphatech dot com
2003-11-02  1:11 ` rmerkert at alphatech dot com
2003-11-02  2:21 ` carlo at gcc dot gnu dot org
2003-11-02 21:58 ` [Bug libstdc++/12873] [3.3 only] " pinskia at gcc dot gnu dot org
2003-12-05  7:04 ` bkoz 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).