This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: PR other/42602: demangler doesn't completely demangle a global constructors symbol
- From: Ian Lance Taylor <iant at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, ian at airs dot com
- Date: Tue, 16 Nov 2010 09:40:13 -0800
- Subject: Re: PATCH: PR other/42602: demangler doesn't completely demangle a global constructors symbol
- References: <20100109184205.GA21039@lucon.org>
On Sat, Jan 9, 2010 at 10:42 AM, H.J. Lu <firstname.lastname@example.org> wrote:
> 2010-01-09 ?H.J. Lu ?<email@example.com>
> ? ? ? ?PR other/42602
> ? ? ? ?* cp-demangle.c (d_make_demangle_mangled_name): New.
> ? ? ? ?(d_demangle_callback): Use it on DCT_GLOBAL_XTORS.
> ? ? ? ?* testsuite/demangle-expected: Updated.
> +/* Add a new demangle mangled name component. ?*/
> +static struct demangle_component *
> +d_make_demangle_mangled_name (struct d_info *di, const char *s, int len)
> + ?if (d_peek_char (di) != '_' || d_peek_next_char (di) != 'Z')
> + ? ?return d_make_name (di, s, len);
> + ?d_advance (di, 2);
> + ?return d_encoding (di, 0);
Don't pass len to this function. It should only take two parameters,
di and s. The functoin will only work correctly when called at the
end of the name being demangled, so passing len is deceptive. It
should just call strlen (s) in the case where it calls d_make_name.
This patch is OK with that change.