This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Ambiguous G++ name mangling grammar
- To: cvar at erols dot com
- Subject: Re: Ambiguous G++ name mangling grammar
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Fri, 29 Oct 1999 12:05:31 +0200
- CC: gcc-bugs at gcc dot gnu dot org, ibc at ocsystems dot com, aprobe at ocsystems dot com
- References: <000001bf1dd4$a5b46b00$9186a4d8@isdn_ibc.ocsystems.com>
> The mangled names produced by g++ appear to be suffering from an ambiguous
> grammar, and therefore, cannot be readily parsed during demangling (see
> cplus-dem.c).
Thanks for your bug report. gcc-2.95.2 seems to solve this problem.
> It's mangled as "maximum__H2ZiZi_X01X11N21_X01", and so the "N21_" part is
> treated as 21 repeats of ?junk? instead of 2 repeats of type 1.
In 2.95.2, this is mangled as maximum__H2ZiZi_X01X11X11X11_X01, which
nicely demangles as nt maximum<int, int>(int, int, int, int)
> Example 1b:
> ----------
> struct fcc {} XXX;
> template <class T, class U>
> fcc maximum (T value1, T value2, T value3, T value4, T value5,
> U walue1, U walue2, U walue3, U walue4, U walue5)
> {
> return XXX;
> }
> main ()
> {
> maximum (111, 222, 333, 444, 555, 'a', 'b', 'c', 'd', 'e');
> }
>
> It's mangled as "maximum__H2ZiZc_X01N40X11N45_3foo", and so the "N45_3" part
> now looks perfectly valid (but it's not!).
I don't know where it got the "foo" from, I only see "fcc" in your
example. In 2.95.2, this becomes
maximum__H2ZiZc_X01X01X01X01X01X11X11X11X11X11_3fcc
> It's mangled as "maximum__H3ZdZcZd_X01N40X11N45X21N410_ic_X21"
This is now maximum__H3ZdZcZd_X01X01X01X01X01X11X11X11X11X11X21X21X21X21X21ic_X21
Regards,
Martin