public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/37718]  New: Demangling of variadic functions
@ 2008-10-02 17:13 jakub at gcc dot gnu dot org
  2008-10-03  2:29 ` [Bug libstdc++/37718] " jason at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-02 17:13 UTC (permalink / raw)
  To: gcc-bugs

int f()
{
  return 0;
}

template <typename T, typename... U>
int f(T t, U... u)
{
  return (t ? 1 : 0) * sizeof...(U) + f(u...);
}

int
main()
{
  return f(1, 1.0, 2);
}

has 3 mangled names, but 2 of them demangle weirdly (I'd say we should demangle
U10__variadic to something containing ..., not __variadic) and one doesn't
demangle at all:

#include <cxxabi.h>
#include <iostream>

int
main ()
{
  char buf[128];
  size_t len;
  int status;
  len = sizeof (buf);
  status = 0;
  abi::__cxa_demangle ("_Z1fIdiEiT_U10__variadicT0_", buf, &len, &status);
  std::cout << buf << " " << len << " " << status << std::endl;
  abi::__cxa_demangle ("_Z1fIiEiT_U10__variadicT0_", buf, &len, &status);
  std::cout << buf << " " << len << " " << status << std::endl;
  abi::__cxa_demangle ("_Z1fIidiEiT_U10__variadicT0_", buf, &len, &status);
  std::cout << buf << " " << len << " " << status << std::endl;
}

G++ in all cases mangles the variadic arg as U10__variadicT0_, as the variadic
template parameter is 2nd, but that parameter is never mangled among the I
parameters and so the demangler considers it out of range and refuses to
demangle it.  Not mentioning the parameter packs in the I list IMHO has a
bigger
effect than just having out of range U10__variadic template parameter types.
As for functions the parameter packs don't need to be at the end of template
argument list, we get out of range mangling even for say:
template <typename T, typename... U, typename W, typename ... V>
int foo (T a, W b)
{
  return a + b;
}

int
bar (void)
{
  return foo (1, 2);
}

_Z3fooIiiEiT_T1_


-- 
           Summary: Demangling of variadic functions
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug libstdc++/37718] Demangling of variadic functions
  2008-10-02 17:13 [Bug libstdc++/37718] New: Demangling of variadic functions jakub at gcc dot gnu dot org
@ 2008-10-03  2:29 ` jason at redhat dot com
  2008-10-03 10:53 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jason at redhat dot com @ 2008-10-03  2:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jason at redhat dot com  2008-10-03 02:27 -------
Subject: Re:   New: Demangling of variadic functions

I've been working on a bunch of mangling/demangling issues lately, this 
among them.

Jason


-- 


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


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

* [Bug libstdc++/37718] Demangling of variadic functions
  2008-10-02 17:13 [Bug libstdc++/37718] New: Demangling of variadic functions jakub at gcc dot gnu dot org
  2008-10-03  2:29 ` [Bug libstdc++/37718] " jason at redhat dot com
@ 2008-10-03 10:53 ` paolo dot carlini at oracle dot com
  2008-10-07 23:12 ` jan dot kratochvil at redhat dot com
  2008-11-14 23:19 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-03 10:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2008-10-03 10:51 -------
Then, I guess we can just assign to Jason.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jason at gcc dot gnu dot org|
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-10-03 10:51:58
               date|                            |


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


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

* [Bug libstdc++/37718] Demangling of variadic functions
  2008-10-02 17:13 [Bug libstdc++/37718] New: Demangling of variadic functions jakub at gcc dot gnu dot org
  2008-10-03  2:29 ` [Bug libstdc++/37718] " jason at redhat dot com
  2008-10-03 10:53 ` paolo dot carlini at oracle dot com
@ 2008-10-07 23:12 ` jan dot kratochvil at redhat dot com
  2008-11-14 23:19 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2008-10-07 23:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jan dot kratochvil at redhat dot com  2008-10-07 23:10 -------
FYI I find at least this specific reported testcase as already fixed by Jason:

http://gcc.gnu.org/ml/gcc-patches/2008-09/msg00729.html
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00189.html

GCC now even produces different mangled names:
GNU C++ (GCC) version 4.4.0 20081007 (experimental) (x86_64-unknown-linux-gnu)
 compiled by GNU C version 4.4.0 20081007 (experimental), GMP version 4.2.2,
MPFR version 2.3.1.

00000000004005c3 w F .text 000000000000003f _Z1fIdIiEEiT_DpT0_
0000000000400602 w F .text 0000000000000012 _Z1fIiIEEiT_DpT0_ 
0000000000400584 w F .text 000000000000003f _Z1fIiIdiEEiT_DpT0_

00000000004005c3 w F .text 000000000000003f int f<double, int>(double, int) 
0000000000400602 w F .text 0000000000000012 int f<int, >(int, )
0000000000400584 w F .text 000000000000003f int f<int, double, int>(int,
double, int)


-- 

jan dot kratochvil at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan dot kratochvil at redhat
                   |                            |dot com


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


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

* [Bug libstdc++/37718] Demangling of variadic functions
  2008-10-02 17:13 [Bug libstdc++/37718] New: Demangling of variadic functions jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-10-07 23:12 ` jan dot kratochvil at redhat dot com
@ 2008-11-14 23:19 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-14 23:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at gcc dot gnu dot org  2008-11-14 23:18 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-11-14 23:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02 17:13 [Bug libstdc++/37718] New: Demangling of variadic functions jakub at gcc dot gnu dot org
2008-10-03  2:29 ` [Bug libstdc++/37718] " jason at redhat dot com
2008-10-03 10:53 ` paolo dot carlini at oracle dot com
2008-10-07 23:12 ` jan dot kratochvil at redhat dot com
2008-11-14 23:19 ` jason 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).