[PATCH] libiberty: Initialize d_printing in all cplus_demangle_* functions.

Mark Wielaard mark@klomp.org
Mon Mar 13 18:29:00 GMT 2017

On Mon, Mar 13, 2017 at 07:11:50PM +0100, Markus Trippelsdorf wrote:
> On 2017.03.12 at 23:05 +0100, Mark Wielaard wrote:
> > While integrating the d_printing recursion guard change into gdb I
> > noticed we forgot to initialize the demangle_component d_printing
> > field in cplus_demangle_fill_{name,extended_operator,ctor,dtor}.
> > As is done in cplus_demangle_fill_{component,builtin_type,operator}.
> > It happened to work because in gcc all demangle_components were
> > allocated through d_make_empty. But gdb has its own allocation
> > mechanism (as might other users).
> Nick has synced the binutils-gdb repro with gcc's. 
> I think you should commit your fix as obvious.

Ian just approved it and I checked it in. gcc svn r246105.

> And it would be nice if Nick could sync again, after your patch went in.

O, sorry. I should have let Nick known about the gdb regressions I found.
Besides this patch gdb needs the following one-liner fix:

diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index fd1e949..5278c05 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -201,6 +201,7 @@ make_empty (enum demangle_component_type d_type)
   struct demangle_component *ret = d_grab ();
   ret->type = d_type;
+  ret->d_printing = 0;
   return ret;



More information about the Gcc-patches mailing list