Ambiguous G++ name mangling grammar
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Sun Oct 31 23:03:00 GMT 1999
> 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
More information about the Gcc-bugs
mailing list